File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
explode.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 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--
explode() function
--INI--
error_reporting=2047
--FILE--
<?php
/* From http://bugs.php.net/19865 */
echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE);
echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE));
echo "\n";
var_dump(@explode("", ""));
var_dump(@explode("", NULL));
var_dump(@explode(NULL, ""));
var_dump(@explode("a", ""));
var_dump(@explode("a", "a"));
var_dump(@explode("a", NULL));
var_dump(@explode(NULL, a));
var_dump(@explode("abc", "acb"));
var_dump(@explode("somestring", "otherstring"));
var_dump(@explode("somestring", "otherstring", -1));
var_dump(@explode("a", "aaaaaa"));
var_dump(@explode("==", str_repeat("-=".ord(0)."=-", 10)));
var_dump(@explode("=", str_repeat("-=".ord(0)."=-", 10)));
//////////////////////////////////////
var_dump(explode(":","a lazy dog:jumps:over:",-1));
var_dump(explode(":","a lazy dog:jumps:over", -1));
var_dump(explode(":","a lazy dog:jumps:over", -2));
var_dump(explode(":","a lazy dog:jumps:over:",-4));
var_dump(explode(":","a lazy dog:jumps:over:",-40000000000000));
var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-1));
var_dump(explode(":^:","a lazy dog:^:jumps::over:^:",-2));
?>
--EXPECTF--
array (
0 => 'a',
1 => 'b' . "\0" . 'd',
2 => 'f',
3 => '1',
4 => 'd',
)d6bee42a771449205344c0938ad4f035
bool(false)
bool(false)
bool(false)
array(1) {
[0]=>
string(0) ""
}
array(2) {
[0]=>
string(0) ""
[1]=>
string(0) ""
}
array(1) {
[0]=>
string(0) ""
}
bool(false)
array(1) {
[0]=>
string(3) "acb"
}
array(1) {
[0]=>
string(11) "otherstring"
}
array(0) {
}
array(7) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
string(0) ""
[3]=>
string(0) ""
[4]=>
string(0) ""
[5]=>
string(0) ""
[6]=>
string(0) ""
}
array(1) {
[0]=>
string(60) "-=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=--=48=-"
}
array(21) {
[0]=>
string(1) "-"
[1]=>
string(2) "48"
[2]=>
string(2) "--"
[3]=>
string(2) "48"
[4]=>
string(2) "--"
[5]=>
string(2) "48"
[6]=>
string(2) "--"
[7]=>
string(2) "48"
[8]=>
string(2) "--"
[9]=>
string(2) "48"
[10]=>
string(2) "--"
[11]=>
string(2) "48"
[12]=>
string(2) "--"
[13]=>
string(2) "48"
[14]=>
string(2) "--"
[15]=>
string(2) "48"
[16]=>
string(2) "--"
[17]=>
string(2) "48"
[18]=>
string(2) "--"
[19]=>
string(2) "48"
[20]=>
string(1) "-"
}
array(3) {
[0]=>
string(10) "a lazy dog"
[1]=>
string(5) "jumps"
[2]=>
string(4) "over"
}
array(2) {
[0]=>
string(10) "a lazy dog"
[1]=>
string(5) "jumps"
}
array(1) {
[0]=>
string(10) "a lazy dog"
}
array(0) {
}
array(0) {
}
array(2) {
[0]=>
string(10) "a lazy dog"
[1]=>
string(11) "jumps::over"
}
array(1) {
[0]=>
string(10) "a lazy dog"
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>