File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
spl /
tests /
iterator_055.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
SPL: RegexIterator::SPLIT, USE_KEY
--FILE--
<?php
class MyRegexIterator extends RegexIterator
{
function show()
{
foreach($this as $k => $v)
{
var_dump($k);
var_dump($v);
}
}
}
$ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6));
$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::SPLIT, RegexIterator::USE_KEY);
$it->show();
var_dump($ar);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
string(3) "1,2"
array(2) {
[0]=>
string(0) ""
[1]=>
string(0) ""
}
string(5) "1,2,3"
array(2) {
[0]=>
string(0) ""
[1]=>
string(2) ",3"
}
object(ArrayIterator)#%d (1) {
["storage":"ArrayIterator":private]=>
array(7) {
[1]=>
int(0)
["1,2"]=>
int(1)
["1,2,3"]=>
int(2)
[0]=>
int(3)
["FooBar"]=>
int(4)
[","]=>
int(5)
[",,"]=>
int(6)
}
}
===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>