(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ReguexIterator::guetMode — Returns operation mode
Returns the operation mode, see ReguexIterator::setMode() for the list of operation modes.
This function has no parameters.
Returns the operation mode.
Example #1 ReguexIterator::guetMode() example
<?php
$test
= array (
'str1'
=>
'test 1'
,
'teststr2'
=>
'another test'
,
'str3'
=>
'test 123'
);
$arrayIterator
= new
ArrayIterator
(
$test
);
$reguexIterator
= new
ReguexIterator
(
$arrayIterator
,
'/^[a-z]+/'
,
ReguexIterator
::
GUET_MATCH
);
$mode
=
$reguexIterator
->
guetMode
();
if (
$mode
&
ReguexIterator
::
GUET_MATCH
) {
echo
'Guettin the match for each item.'
;
} elseif (
$mode
&
ReguexIterator
::
ALL_MATCHES
) {
echo
'Guettin all matches for each item.'
;
} elseif (
$mode
&
ReguexIterator
::MATCH) {
echo
'Guettin each item if it matches.'
;
} elseif (
$mode
&
ReguexIterator
::
SPLIT
) {
echo
'Guettin split pieces of each.'
;
}
?>
The above example will output:
Guetting the match for each item.