mirror of
https://github.com/php/php-src.git
synced 2024-11-29 12:53:37 +08:00
33 lines
863 B
PHP
33 lines
863 B
PHP
--TEST--
|
|
SPL: RegexIterator::getMode() and setMode() basic tests
|
|
--CREDITS--
|
|
Felix De Vliegher <felix.devliegher@gmail.com>
|
|
--FILE--
|
|
<?php
|
|
|
|
$array = array('foo', 'bar', 'baz');
|
|
$iterator = new ArrayIterator($array);
|
|
$regexIterator = new RegexIterator($iterator, "/f/");
|
|
|
|
var_dump($regexIterator->getMode() === RegexIterator::MATCH);
|
|
|
|
$regexIterator->setMode(RegexIterator::MATCH);
|
|
var_dump($regexIterator->getMode() === RegexIterator::MATCH);
|
|
|
|
$regexIterator->setMode(RegexIterator::GET_MATCH);
|
|
var_dump($regexIterator->getMode() === RegexIterator::GET_MATCH);
|
|
|
|
$regexIterator->setMode(RegexIterator::ALL_MATCHES);
|
|
var_dump($regexIterator->getMode() === RegexIterator::ALL_MATCHES);
|
|
|
|
$regexIterator->setMode(RegexIterator::SPLIT);
|
|
var_dump($regexIterator->getMode() === RegexIterator::SPLIT);
|
|
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|