zoe Fri Mar 16 12:55:38 2007 UTC
Added files:
/php-src/ext/standard/tests/strings strlen.phpt strcmp.phpt
strcasecmp.phpt
Log:
new test cases for string functions
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strlen.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/strlen.phpt
+++ php-src/ext/standard/tests/strings/strlen.phpt
--TEST--
strlen() function // returns the length of a given string
--INI--
precision = 12
--FILE--
<?php
echo "#### Basic operations and variations ####\n";
$strings = array( "Hello, World",
'Hello, World',
'!!Hello, World',
"??Hello, World",
"[EMAIL PROTECTED]&*!~,.:;?",
"123",
123,
"-1.2345",
-1.2344,
NULL,
"",
" ",
"\0",
"\x000", // len = 2
"\xABC", // len = 2
"\0000", // len = 2
"0",
0,
"\t", // len = 1
'\t', // len = 2
TRUE,
FALSE,
"Hello, World\0",
"Hello\0World",
'Hello, World\0',
"Hello, World\n",
"Hello, World\r",
"Hello, World\t",
"Hello, World\\",
" ",
chr(128).chr(234).chr(65).chr(255).chr(256),
"[EMAIL PROTECTED]&*()_+=|?><-;:$
[]{}{{{}}}[[[[]][]]]***&&&^^%$###@@[EMAIL
PROTECTED]&^&**/////|\\\\\\
[EMAIL PROTECTED]&*()_+=|?><-;:$
[]{}{{{}}}[[[[]][]]]***&&&^^%$###@@[EMAIL
PROTECTED]&^&**/////|\\\\\\
[EMAIL PROTECTED]&*()_+=|?><-;:$
[]{}{{{}}}[[[[]][]]]***&&&^^%$###@@[EMAIL
PROTECTED]&^&**/////|\\\\\\
abcdefghijklmnopqrstuvwxyz0123456789"
);
/* loop through to find the length of each string */
for($i=0; $i<count($strings); $i++) {
echo "String length of '$strings[$i]' is => ";
var_dump( strlen($strings[$i]) );
}
echo "\n#### Testing Miscelleneous inputs ####\n";
echo "--- Testing objects ---\n";
/* we get "Catchable fatal error: saying Object of class could not be converted
to string" by default when an object is passed instead of string:
The error can be avoided by chosing the __toString magix method as follows: */
class string {
function __toString() {
return "Hello, world";
}
}
$obj_string = new string;
var_dump(strlen("$obj_string"));
echo "\n--- Testing arrays ---\n";
$str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!", array());
var_dump(strlen($str_arr));
var_dump(strlen("$str_arr[1]"));
var_dump(strlen("$str_arr[2]"));
echo "\n--- Testing Resources ---\n";
$filename1 = "dummy.txt";
$file1 = fopen($filename1, "w"); // creating new file
/* getting resource type for file handle */
$string1 = get_resource_type($file1);
$string2 = (int)get_resource_type($file1); // converting stream type to int
/* $string1 is of "stream" type */
var_dump(strlen($string1)); // int(6)
/* $string2 holds a value of "int(0)" */
var_dump(strlen($string2)); // int(1)
fclose($file1); // closing the file "dummy.txt"
unlink("$filename1"); // deletes "dummy.txt"
echo "\n--- Testing a longer and heredoc string ---\n";
$string = <<<EOD
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
@#$%^&**&[EMAIL PROTECTED]:())))((((&&&**%$###@@@[EMAIL PROTECTED]&*
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
EOD;
var_dump(strlen($string));
echo "\n--- Testing a heredoc null string ---\n";
$str = <<<EOD
EOD;
var_dump(strlen($str));
echo "\n--- Testing simple and complex syntax strings ---\n";
$str = 'world';
/* Simple syntax */
var_dump(strlen("$str"));
var_dump(strlen("$str'S"));
var_dump(strlen("$strS"));
/* String with curly braces, complex syntax */
var_dump(strlen("${str}S"));
var_dump(strlen("{$str}S"));
echo "\n--- strlen for long float values ---\n";
/* Here two different outputs, which depends on the rounding value
before converting to string. Here Precision = 12 */
var_dump(strlen(10.55555555555555555555555555)); // len = 13
var_dump(strlen(10.55555555595555555555555555)); // len = 12
echo "\n--- Nested strlen() ---\n";
var_dump(strlen(strlen("Hello"))); // len=1
echo "\n#### error conditions ####";
/* Zero arguments */
strlen();
/* Greater number of args than expected */
strlen("string1", "string2");
strlen("", "");
echo "Done\n";
?>
--EXPECTF--
#### Basic operations and variations ####
String length of 'Hello, World' is => int(12)
String length of 'Hello, World' is => int(12)
String length of '!!Hello, World' is => int(14)
String length of '??Hello, World' is => int(14)
String length of '[EMAIL PROTECTED]&*!~,.:;?' is => int(14)
String length of '123' is => int(3)
String length of '123' is => int(3)
String length of '-1.2345' is => int(7)
String length of '-1.2344' is => int(7)
String length of '' is => int(0)
String length of '' is => int(0)
String length of ' ' is => int(1)
String length of '
String length of '
String length of '«C' is => int(2)
String length of '
String length of '0' is => int(1)
String length of '0' is => int(1)
String length of ' ' is => int(1)
String length of '\t' is => int(2)
String length of '1' is => int(1)
String length of '' is => int(0)
String length of 'Hello, World
String length of 'Hello
String length of 'Hello, World\0' is => int(14)
String length of 'Hello, World
' is => int(13)
String length of 'Hello, World' is => int(13)
String length of 'Hello, World ' is => int(13)
String length of 'Hello, World\' is => int(13)
String length of ' ' is => int(14)
String length of 'êAÿ
String length of '[EMAIL PROTECTED]&*()_+=|?><-;:$
[]{}{{{}}}[[[[]][]]]***&&&^^%$###@@[EMAIL
PROTECTED]&^&**/////|\\\
[EMAIL PROTECTED]&*()_+=|?><-;:$
[]{}{{{}}}[[[[]][]]]***&&&^^%$###@@[EMAIL
PROTECTED]&^&**/////|\\\
[EMAIL PROTECTED]&*()_+=|?><-;:$
[]{}{{{}}}[[[[]][]]]***&&&^^%$###@@[EMAIL
PROTECTED]&^&**/////|\\\
abcdefghijklmnopqrstuvwxyz0123456789' is => int(495)
#### Testing Miscelleneous inputs ####
--- Testing objects ---
int(12)
--- Testing arrays ---
Notice: Array to string conversion in %s on line %d
int(5)
int(6)
int(20)
--- Testing Resources ---
int(6)
int(1)
--- Testing a longer and heredoc string ---
int(639)
--- Testing a heredoc null string ---
int(0)
--- Testing simple and complex syntax strings ---
int(5)
int(7)
Notice: Undefined variable: strS in %s on line %d
int(0)
int(6)
int(6)
--- strlen for long float values ---
int(13)
int(12)
--- Nested strlen() ---
int(1)
#### error conditions ####
Warning: Wrong parameter count for strlen() in %s on line %d
Warning: Wrong parameter count for strlen() in %s on line %d
Warning: Wrong parameter count for strlen() in %s on line %d
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcmp.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/strcmp.phpt
+++ php-src/ext/standard/tests/strings/strcmp.phpt
--TEST--
"strcmp()" function // Compares two strings in case-sensitive manner
--INI--
precision = 12
--FILE--
<?php
echo "#### Basic and Possible operations ####";
/* creating an array of strings to be compared */
$arrays = array(
array("a", "A", 'a', 'A', chr(128), chr(255), chr(256)),
array("acc", "Acc", 'ac', "accc", 'acd', "?acc", 'acc!', "$!acc",
";acc"),
array("1", "0", 0, "-1", -1, NULL, "", TRUE, FALSE, "string"),
array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5)
);
/* loop through to go each and every element in an array
and comparing the elements with one and other */
foreach($arrays as $str1_arr){
echo "\n*** comparing the strings in an \n";
print_r($str1_arr);
for ($i=0; $i<count($str1_arr); $i++){
echo "\nIteration $i\n";
for($j=0; $j<count($str1_arr); $j++){
echo "- strcmp of '$str1_arr[$i]' and '$str1_arr[$j]' is => ";
var_dump(strcmp($str1_arr[$i], $str1_arr[$j]));
}
}
}
echo "\n#### Testing Miscelleneous inputs ####\n";
echo "--- Testing objects ---\n";
/* we get "Catchable fatal error: saying Object of class could not be converted
to string" by default, when an object is passed instead of string.
The error can be avoided by chosing the __toString magix method as follows: */
class string1 {
function __toString() {
return "Hello, world";
}
}
$obj_string1 = new string1;
class string2 {
function __toString() {
return "Hello, world\0";
}
}
$obj_string2 = new string2;
var_dump(strcmp("$obj_string1", "$obj_string2"));
echo "\n--- Testing arrays ---\n";
$str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!");
var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", $str_arr));
var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[1]"));
var_dump(strcmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[2]"));
echo "\n--- Testing Resources ---\n";
$filename1 = "dummy.txt";
$filename2 = "dummy1.txt";
$file1 = fopen($filename1, "w"); // creating new file
$file2 = fopen($filename2, "w"); // creating new file
/* getting resource type for file handle */
$string1 = get_resource_type($file1);
$string2 = get_resource_type($file2);
$string3 = (int)get_resource_type($file2);
/* string1 and string2 of same "stream" type */
var_dump(strcmp($string1, $string2)); // int(0)
/* string1 is of "stream" type & string3 is of "int" type */
var_dump(strcmp($string1, $string3)); // int(1)
fclose($file1); // closing the file "dummy.txt"
fclose($file2); // closing the file "dummy1.txt"
unlink("$filename1"); // deletes "dummy.txt"
unlink("$filename2"); // deletes "dummy1.txt"
echo "\n--- Testing a longer and heredoc string ---\n";
$string = <<<EOD
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
@#$%^&**&[EMAIL PROTECTED]:())))((((&&&**%$###@@@[EMAIL PROTECTED]&*
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
EOD;
var_dump(strcmp($string, $string));
var_dump(strcmp($string, "xyz0123456789"));
var_dump(strcmp($string, "&&&"));
echo "\n--- Testing a heredoc null string ---\n";
$str = <<<EOD
EOD;
var_dump(strcmp($str, "\0"));
var_dump(strcmp($str, NULL));
var_dump(strcmp($str, "0"));
echo "\n--- Testing simple and complex syntax strings ---\n";
$str = 'world';
/* Simple syntax */
var_dump(strcmp("Hello, world", "$str"));
var_dump(strcmp("Hello, world'S", "$str'S"));
var_dump(strcmp("Hello, worldS", "$strS"));
/* String with curly braces, complex syntax */
var_dump(strcmp("Hello, worldS", "${str}S"));
var_dump(strcmp("Hello, worldS", "{$str}S"));
echo "\n--- Testing binary safe and binary chars ---\n";
var_dump(strcmp("Hello\0world", "Hello"));
var_dump(strcmp("Hello\0world", "Helloworld"));
var_dump(strcmp("\x0", "\0"));
var_dump(strcmp("\000", "\0"));
var_dump(strcmp("\x00", ""));
var_dump(strcmp("\x00", NULL));
var_dump(strcmp("\000", NULL));
echo "\n--- Comparing long float values ---\n";
/* Here two different outputs, which depends on the rounding value
before converting to string. Here Precision = 12 */
var_dump(strcmp(10.55555555555555555555555555, 10.5555555556)); // int(0)
var_dump(strcmp(10.55555555555555555555555555, 10.555555556)); // int(-1)
var_dump(strcmp(10.55555555595555555555555555, 10.555555556)); // int(0)
echo "\n#### checking error conditions ####";
strcmp();
strcmp("");
strcmp("HI");
strcmp("Hi", "Hello", "World");
echo "Done\n";
?>
--EXPECTF--
#### Basic and Possible operations ####
*** comparing the strings in an
Array
(
[0] => a
[1] => A
[2] => a
[3] => A
[4] =>
[5] => ÿ
[6] =>
)
Iteration 0
- strcmp of 'a' and 'a' is => int(0)
- strcmp of 'a' and 'A' is => int(%d)
- strcmp of 'a' and 'a' is => int(0)
- strcmp of 'a' and 'A' is => int(%d)
- strcmp of 'a' and '' is => int(-%d)
- strcmp of 'a' and 'ÿ' is => int(-%d)
- strcmp of 'a' and '
Iteration 1
- strcmp of 'A' and 'a' is => int(-%d)
- strcmp of 'A' and 'A' is => int(0)
- strcmp of 'A' and 'a' is => int(-%d)
- strcmp of 'A' and 'A' is => int(0)
- strcmp of 'A' and '' is => int(-%d)
- strcmp of 'A' and 'ÿ' is => int(-%d)
- strcmp of 'A' and '
Iteration 2
- strcmp of 'a' and 'a' is => int(0)
- strcmp of 'a' and 'A' is => int(%d)
- strcmp of 'a' and 'a' is => int(0)
- strcmp of 'a' and 'A' is => int(%d)
- strcmp of 'a' and '' is => int(-%d)
- strcmp of 'a' and 'ÿ' is => int(-%d)
- strcmp of 'a' and '
Iteration 3
- strcmp of 'A' and 'a' is => int(-%d)
- strcmp of 'A' and 'A' is => int(0)
- strcmp of 'A' and 'a' is => int(-%d)
- strcmp of 'A' and 'A' is => int(0)
- strcmp of 'A' and '' is => int(-%d)
- strcmp of 'A' and 'ÿ' is => int(-%d)
- strcmp of 'A' and '
Iteration 4
- strcmp of '' and 'a' is => int(%d)
- strcmp of '' and 'A' is => int(%d)
- strcmp of '' and 'a' is => int(%d)
- strcmp of '' and 'A' is => int(%d)
- strcmp of '' and '' is => int(0)
- strcmp of '' and 'ÿ' is => int(-%d)
- strcmp of '' and '
Iteration 5
- strcmp of 'ÿ' and 'a' is => int(%d)
- strcmp of 'ÿ' and 'A' is => int(%d)
- strcmp of 'ÿ' and 'a' is => int(%d)
- strcmp of 'ÿ' and 'A' is => int(%d)
- strcmp of 'ÿ' and '' is => int(%d)
- strcmp of 'ÿ' and 'ÿ' is => int(0)
- strcmp of 'ÿ' and '
Iteration 6
- strcmp of '
- strcmp of '
- strcmp of '
- strcmp of '
- strcmp of '
- strcmp of '
- strcmp of '
*** comparing the strings in an
Array
(
[0] => acc
[1] => Acc
[2] => ac
[3] => accc
[4] => acd
[5] => ?acc
[6] => acc!
[7] => $!acc
[8] => ;acc
)
Iteration 0
- strcmp of 'acc' and 'acc' is => int(0)
- strcmp of 'acc' and 'Acc' is => int(%d)
- strcmp of 'acc' and 'ac' is => int(%d)
- strcmp of 'acc' and 'accc' is => int(-%d)
- strcmp of 'acc' and 'acd' is => int(-%d)
- strcmp of 'acc' and '?acc' is => int(%d)
- strcmp of 'acc' and 'acc!' is => int(-%d)
- strcmp of 'acc' and '$!acc' is => int(%d)
- strcmp of 'acc' and ';acc' is => int(%d)
Iteration 1
- strcmp of 'Acc' and 'acc' is => int(-%d)
- strcmp of 'Acc' and 'Acc' is => int(0)
- strcmp of 'Acc' and 'ac' is => int(-%d)
- strcmp of 'Acc' and 'accc' is => int(-%d)
- strcmp of 'Acc' and 'acd' is => int(-%d)
- strcmp of 'Acc' and '?acc' is => int(%d)
- strcmp of 'Acc' and 'acc!' is => int(-%d)
- strcmp of 'Acc' and '$!acc' is => int(%d)
- strcmp of 'Acc' and ';acc' is => int(%d)
Iteration 2
- strcmp of 'ac' and 'acc' is => int(-%d)
- strcmp of 'ac' and 'Acc' is => int(%d)
- strcmp of 'ac' and 'ac' is => int(0)
- strcmp of 'ac' and 'accc' is => int(-%d)
- strcmp of 'ac' and 'acd' is => int(-%d)
- strcmp of 'ac' and '?acc' is => int(%d)
- strcmp of 'ac' and 'acc!' is => int(-%d)
- strcmp of 'ac' and '$!acc' is => int(%d)
- strcmp of 'ac' and ';acc' is => int(%d)
Iteration 3
- strcmp of 'accc' and 'acc' is => int(%d)
- strcmp of 'accc' and 'Acc' is => int(%d)
- strcmp of 'accc' and 'ac' is => int(%d)
- strcmp of 'accc' and 'accc' is => int(0)
- strcmp of 'accc' and 'acd' is => int(-%d)
- strcmp of 'accc' and '?acc' is => int(%d)
- strcmp of 'accc' and 'acc!' is => int(%d)
- strcmp of 'accc' and '$!acc' is => int(%d)
- strcmp of 'accc' and ';acc' is => int(%d)
Iteration 4
- strcmp of 'acd' and 'acc' is => int(%d)
- strcmp of 'acd' and 'Acc' is => int(%d)
- strcmp of 'acd' and 'ac' is => int(%d)
- strcmp of 'acd' and 'accc' is => int(%d)
- strcmp of 'acd' and 'acd' is => int(0)
- strcmp of 'acd' and '?acc' is => int(%d)
- strcmp of 'acd' and 'acc!' is => int(%d)
- strcmp of 'acd' and '$!acc' is => int(%d)
- strcmp of 'acd' and ';acc' is => int(%d)
Iteration 5
- strcmp of '?acc' and 'acc' is => int(-%d)
- strcmp of '?acc' and 'Acc' is => int(-%d)
- strcmp of '?acc' and 'ac' is => int(-%d)
- strcmp of '?acc' and 'accc' is => int(-%d)
- strcmp of '?acc' and 'acd' is => int(-%d)
- strcmp of '?acc' and '?acc' is => int(0)
- strcmp of '?acc' and 'acc!' is => int(-%d)
- strcmp of '?acc' and '$!acc' is => int(%d)
- strcmp of '?acc' and ';acc' is => int(%d)
Iteration 6
- strcmp of 'acc!' and 'acc' is => int(%d)
- strcmp of 'acc!' and 'Acc' is => int(%d)
- strcmp of 'acc!' and 'ac' is => int(%d)
- strcmp of 'acc!' and 'accc' is => int(-%d)
- strcmp of 'acc!' and 'acd' is => int(-%d)
- strcmp of 'acc!' and '?acc' is => int(%d)
- strcmp of 'acc!' and 'acc!' is => int(0)
- strcmp of 'acc!' and '$!acc' is => int(%d)
- strcmp of 'acc!' and ';acc' is => int(%d)
Iteration 7
- strcmp of '$!acc' and 'acc' is => int(-%d)
- strcmp of '$!acc' and 'Acc' is => int(-%d)
- strcmp of '$!acc' and 'ac' is => int(-%d)
- strcmp of '$!acc' and 'accc' is => int(-%d)
- strcmp of '$!acc' and 'acd' is => int(-%d)
- strcmp of '$!acc' and '?acc' is => int(-%d)
- strcmp of '$!acc' and 'acc!' is => int(-%d)
- strcmp of '$!acc' and '$!acc' is => int(0)
- strcmp of '$!acc' and ';acc' is => int(-%d)
Iteration 8
- strcmp of ';acc' and 'acc' is => int(-%d)
- strcmp of ';acc' and 'Acc' is => int(-%d)
- strcmp of ';acc' and 'ac' is => int(-%d)
- strcmp of ';acc' and 'accc' is => int(-%d)
- strcmp of ';acc' and 'acd' is => int(-%d)
- strcmp of ';acc' and '?acc' is => int(-%d)
- strcmp of ';acc' and 'acc!' is => int(-%d)
- strcmp of ';acc' and '$!acc' is => int(%d)
- strcmp of ';acc' and ';acc' is => int(0)
*** comparing the strings in an
Array
(
[0] => 1
[1] => 0
[2] => 0
[3] => -1
[4] => -1
[5] =>
[6] =>
[7] => 1
[8] =>
[9] => string
)
Iteration 0
- strcmp of '1' and '1' is => int(0)
- strcmp of '1' and '0' is => int(%d)
- strcmp of '1' and '0' is => int(%d)
- strcmp of '1' and '-1' is => int(%d)
- strcmp of '1' and '-1' is => int(%d)
- strcmp of '1' and '' is => int(%d)
- strcmp of '1' and '' is => int(%d)
- strcmp of '1' and '1' is => int(0)
- strcmp of '1' and '' is => int(%d)
- strcmp of '1' and 'string' is => int(-%d)
Iteration 1
- strcmp of '0' and '1' is => int(-%d)
- strcmp of '0' and '0' is => int(0)
- strcmp of '0' and '0' is => int(0)
- strcmp of '0' and '-1' is => int(%d)
- strcmp of '0' and '-1' is => int(%d)
- strcmp of '0' and '' is => int(%d)
- strcmp of '0' and '' is => int(%d)
- strcmp of '0' and '1' is => int(-%d)
- strcmp of '0' and '' is => int(%d)
- strcmp of '0' and 'string' is => int(-%d)
Iteration 2
- strcmp of '0' and '1' is => int(-%d)
- strcmp of '0' and '0' is => int(0)
- strcmp of '0' and '0' is => int(0)
- strcmp of '0' and '-1' is => int(%d)
- strcmp of '0' and '-1' is => int(%d)
- strcmp of '0' and '' is => int(%d)
- strcmp of '0' and '' is => int(%d)
- strcmp of '0' and '1' is => int(-%d)
- strcmp of '0' and '' is => int(%d)
- strcmp of '0' and 'string' is => int(-%d)
Iteration 3
- strcmp of '-1' and '1' is => int(-%d)
- strcmp of '-1' and '0' is => int(-%d)
- strcmp of '-1' and '0' is => int(-%d)
- strcmp of '-1' and '-1' is => int(0)
- strcmp of '-1' and '-1' is => int(0)
- strcmp of '-1' and '' is => int(%d)
- strcmp of '-1' and '' is => int(%d)
- strcmp of '-1' and '1' is => int(-%d)
- strcmp of '-1' and '' is => int(%d)
- strcmp of '-1' and 'string' is => int(-%d)
Iteration 4
- strcmp of '-1' and '1' is => int(-%d)
- strcmp of '-1' and '0' is => int(-%d)
- strcmp of '-1' and '0' is => int(-%d)
- strcmp of '-1' and '-1' is => int(0)
- strcmp of '-1' and '-1' is => int(0)
- strcmp of '-1' and '' is => int(%d)
- strcmp of '-1' and '' is => int(%d)
- strcmp of '-1' and '1' is => int(-%d)
- strcmp of '-1' and '' is => int(%d)
- strcmp of '-1' and 'string' is => int(-%d)
Iteration 5
- strcmp of '' and '1' is => int(-%d)
- strcmp of '' and '0' is => int(-%d)
- strcmp of '' and '0' is => int(-%d)
- strcmp of '' and '-1' is => int(-%d)
- strcmp of '' and '-1' is => int(-%d)
- strcmp of '' and '' is => int(0)
- strcmp of '' and '' is => int(0)
- strcmp of '' and '1' is => int(-%d)
- strcmp of '' and '' is => int(0)
- strcmp of '' and 'string' is => int(-%d)
Iteration 6
- strcmp of '' and '1' is => int(-%d)
- strcmp of '' and '0' is => int(-%d)
- strcmp of '' and '0' is => int(-%d)
- strcmp of '' and '-1' is => int(-%d)
- strcmp of '' and '-1' is => int(-%d)
- strcmp of '' and '' is => int(0)
- strcmp of '' and '' is => int(0)
- strcmp of '' and '1' is => int(-%d)
- strcmp of '' and '' is => int(0)
- strcmp of '' and 'string' is => int(-%d)
Iteration 7
- strcmp of '1' and '1' is => int(0)
- strcmp of '1' and '0' is => int(%d)
- strcmp of '1' and '0' is => int(%d)
- strcmp of '1' and '-1' is => int(%d)
- strcmp of '1' and '-1' is => int(%d)
- strcmp of '1' and '' is => int(%d)
- strcmp of '1' and '' is => int(%d)
- strcmp of '1' and '1' is => int(0)
- strcmp of '1' and '' is => int(%d)
- strcmp of '1' and 'string' is => int(-%d)
Iteration 8
- strcmp of '' and '1' is => int(-%d)
- strcmp of '' and '0' is => int(-%d)
- strcmp of '' and '0' is => int(-%d)
- strcmp of '' and '-1' is => int(-%d)
- strcmp of '' and '-1' is => int(-%d)
- strcmp of '' and '' is => int(0)
- strcmp of '' and '' is => int(0)
- strcmp of '' and '1' is => int(-%d)
- strcmp of '' and '' is => int(0)
- strcmp of '' and 'string' is => int(-%d)
Iteration 9
- strcmp of 'string' and '1' is => int(%d)
- strcmp of 'string' and '0' is => int(%d)
- strcmp of 'string' and '0' is => int(%d)
- strcmp of 'string' and '-1' is => int(%d)
- strcmp of 'string' and '-1' is => int(%d)
- strcmp of 'string' and '' is => int(%d)
- strcmp of 'string' and '' is => int(%d)
- strcmp of 'string' and '1' is => int(%d)
- strcmp of 'string' and '' is => int(%d)
- strcmp of 'string' and 'string' is => int(0)
*** comparing the strings in an
Array
(
[0] => 10.5
[1] => 1.5
[2] => 9.5
[3] => 11.5
[4] => 100.5
[5] => 105
[6] => -10.5
[7] => 10
[8] => 0.5
)
Iteration 0
- strcmp of '10.5' and '10.5' is => int(0)
- strcmp of '10.5' and '1.5' is => int(%d)
- strcmp of '10.5' and '9.5' is => int(-%d)
- strcmp of '10.5' and '11.5' is => int(-%d)
- strcmp of '10.5' and '100.5' is => int(-%d)
- strcmp of '10.5' and '105' is => int(-%d)
- strcmp of '10.5' and '-10.5' is => int(%d)
- strcmp of '10.5' and '10' is => int(%d)
- strcmp of '10.5' and '0.5' is => int(%d)
Iteration 1
- strcmp of '1.5' and '10.5' is => int(-%d)
- strcmp of '1.5' and '1.5' is => int(0)
- strcmp of '1.5' and '9.5' is => int(-%d)
- strcmp of '1.5' and '11.5' is => int(-%d)
- strcmp of '1.5' and '100.5' is => int(-%d)
- strcmp of '1.5' and '105' is => int(-%d)
- strcmp of '1.5' and '-10.5' is => int(%d)
- strcmp of '1.5' and '10' is => int(-%d)
- strcmp of '1.5' and '0.5' is => int(%d)
Iteration 2
- strcmp of '9.5' and '10.5' is => int(%d)
- strcmp of '9.5' and '1.5' is => int(%d)
- strcmp of '9.5' and '9.5' is => int(0)
- strcmp of '9.5' and '11.5' is => int(%d)
- strcmp of '9.5' and '100.5' is => int(%d)
- strcmp of '9.5' and '105' is => int(%d)
- strcmp of '9.5' and '-10.5' is => int(%d)
- strcmp of '9.5' and '10' is => int(%d)
- strcmp of '9.5' and '0.5' is => int(%d)
Iteration 3
- strcmp of '11.5' and '10.5' is => int(%d)
- strcmp of '11.5' and '1.5' is => int(%d)
- strcmp of '11.5' and '9.5' is => int(-%d)
- strcmp of '11.5' and '11.5' is => int(0)
- strcmp of '11.5' and '100.5' is => int(%d)
- strcmp of '11.5' and '105' is => int(%d)
- strcmp of '11.5' and '-10.5' is => int(%d)
- strcmp of '11.5' and '10' is => int(%d)
- strcmp of '11.5' and '0.5' is => int(%d)
Iteration 4
- strcmp of '100.5' and '10.5' is => int(%d)
- strcmp of '100.5' and '1.5' is => int(%d)
- strcmp of '100.5' and '9.5' is => int(-%d)
- strcmp of '100.5' and '11.5' is => int(-%d)
- strcmp of '100.5' and '100.5' is => int(0)
- strcmp of '100.5' and '105' is => int(-%d)
- strcmp of '100.5' and '-10.5' is => int(%d)
- strcmp of '100.5' and '10' is => int(%d)
- strcmp of '100.5' and '0.5' is => int(%d)
Iteration 5
- strcmp of '105' and '10.5' is => int(%d)
- strcmp of '105' and '1.5' is => int(%d)
- strcmp of '105' and '9.5' is => int(-%d)
- strcmp of '105' and '11.5' is => int(-%d)
- strcmp of '105' and '100.5' is => int(%d)
- strcmp of '105' and '105' is => int(0)
- strcmp of '105' and '-10.5' is => int(%d)
- strcmp of '105' and '10' is => int(%d)
- strcmp of '105' and '0.5' is => int(%d)
Iteration 6
- strcmp of '-10.5' and '10.5' is => int(-%d)
- strcmp of '-10.5' and '1.5' is => int(-%d)
- strcmp of '-10.5' and '9.5' is => int(-%d)
- strcmp of '-10.5' and '11.5' is => int(-%d)
- strcmp of '-10.5' and '100.5' is => int(-%d)
- strcmp of '-10.5' and '105' is => int(-%d)
- strcmp of '-10.5' and '-10.5' is => int(0)
- strcmp of '-10.5' and '10' is => int(-%d)
- strcmp of '-10.5' and '0.5' is => int(-%d)
Iteration 7
- strcmp of '10' and '10.5' is => int(-%d)
- strcmp of '10' and '1.5' is => int(%d)
- strcmp of '10' and '9.5' is => int(-%d)
- strcmp of '10' and '11.5' is => int(-%d)
- strcmp of '10' and '100.5' is => int(-%d)
- strcmp of '10' and '105' is => int(-%d)
- strcmp of '10' and '-10.5' is => int(%d)
- strcmp of '10' and '10' is => int(0)
- strcmp of '10' and '0.5' is => int(%d)
Iteration 8
- strcmp of '0.5' and '10.5' is => int(-%d)
- strcmp of '0.5' and '1.5' is => int(-%d)
- strcmp of '0.5' and '9.5' is => int(-%d)
- strcmp of '0.5' and '11.5' is => int(-%d)
- strcmp of '0.5' and '100.5' is => int(-%d)
- strcmp of '0.5' and '105' is => int(-%d)
- strcmp of '0.5' and '-10.5' is => int(%d)
- strcmp of '0.5' and '10' is => int(-%d)
- strcmp of '0.5' and '0.5' is => int(0)
#### Testing Miscelleneous inputs ####
--- Testing objects ---
int(-%d)
--- Testing arrays ---
Warning: strcmp() expects parameter 2 to be string (Unicode or binary), array
given in %s on line %d
NULL
int(%d)
int(%d)
--- Testing Resources ---
int(0)
int(%d)
--- Testing a longer and heredoc string ---
int(0)
int(-%d)
int(%d)
--- Testing a heredoc null string ---
int(-%d)
int(0)
int(-%d)
--- Testing simple and complex syntax strings ---
int(-%d)
int(-%d)
Notice: Undefined variable: strS in %s on line %d
int(%d)
int(-%d)
int(-%d)
--- Testing binary safe and binary chars ---
int(%d)
int(-%d)
int(0)
int(0)
int(%d)
int(%d)
int(%d)
--- Comparing long float values ---
int(0)
int(-%d)
int(0)
#### checking error conditions ####
Warning: strcmp() expects exactly 2 parameters, 0 given in %s on line %d
Warning: strcmp() expects exactly 2 parameters, 1 given in %s on line %d
Warning: strcmp() expects exactly 2 parameters, 1 given in %s on line %d
Warning: strcmp() expects exactly 2 parameters, 3 given in %s on line %d
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strcasecmp.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/strcasecmp.phpt
+++ php-src/ext/standard/tests/strings/strcasecmp.phpt
--TEST--
"strcasecmp()" function // Compares two strings in case-insensitive manner
--INI--
precision = 12
--FILE--
<?php
echo "#### Basic and Possible operations ####";
/* creating an array of strings to be compared */
$arrays = array(
array("a", 'A', chr(128), chr(255), chr(256)),
array("acc", "Acc", 'aC', "acCc", 'acd', "?acc", 'Acc!', "$!acc",
";acc"),
array("1", "0", 0, "-1", -1, NULL, null, "", TRUE, true, FALSE,
"string"),
array(10.5, 1.5, 9.5, 11.5, 100.5, 10.5E1, -10.5, 10, 0.5)
);
/* loop through to go each and every element in an array
and comparing the elements with one and other */
foreach($arrays as $str1_arr){
echo "\n*** comparing the strings in an \n";
print_r($str1_arr);
for ($i=0; $i<count($str1_arr); $i++){
echo "\nIteration $i\n";
for($j=0; $j<count($str1_arr); $j++){
echo "- strcasecmp of '$str1_arr[$i]' and '$str1_arr[$j]' is => ";
var_dump(strcasecmp($str1_arr[$i], $str1_arr[$j]));
}
}
}
echo "\n#### Testing Miscelleneous inputs ####\n";
echo "--- Testing objects ---\n";
/* we get "Catchable fatal error: saying Object of class could not be converted
to string" by default when an object is passed instead of string.
The error can be avoided by chosing the __toString magix method as follows: */
class string1 {
function __toString() {
return "Hello, world";
}
}
$obj_string1 = new string1;
class string2 {
function __toString() {
return "hello, world\0";
}
}
$obj_string2 = new string2;
var_dump(strcasecmp("$obj_string1", "$obj_string2"));
echo "\n--- Testing arrays ---\n";
$str_arr = array("hello", "?world", "!$%**()%**[][[[&@#~!");
var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", $str_arr));
var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[1]"));
var_dump(strcasecmp("hello?world,!$%**()%**[][[[&@#~!", "$str_arr[2]"));
echo "\n--- Testing Resources ---\n";
$filename1 = "dummy.txt";
$filename2 = "dummy1.txt";
$file1 = fopen($filename1, "w"); // creating new file
$file2 = fopen($filename2, "w"); // creating new file
/* getting resource type for file handle */
$string1 = get_resource_type($file1);
$string2 = get_resource_type($file2);
$string3 = (int)get_resource_type($file2);
/* string1 and string2 of same "stream" type */
var_dump(strcasecmp($string1, $string2)); // int(0)
/* string1 is of "stream" type & string3 is of "int" type */
var_dump(strcasecmp($string1, $string3)); // int(1)
fclose($file1); // closing the file "dummy.txt"
fclose($file2); // closing the file "dummy1.txt"
unlink("$filename1"); // deletes "dummy.txt"
unlink("$filename2"); // deletes "dummy1.txt"
echo "\n--- Testing a longer and heredoc string ---\n";
$string = <<<EOD
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
@#$%^&**&[EMAIL PROTECTED]:())))((((&&&**%$###@@@[EMAIL PROTECTED]&*
abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
EOD;
var_dump(strcasecmp($string, $string));
var_dump(strcasecmp($string, "xyz0123456789"));
var_dump(strcasecmp($string, "&&&"));
echo "\n--- Testing a heredoc null string ---\n";
$str = <<<EOD
EOD;
var_dump(strcasecmp($str, "\0"));
var_dump(strcasecmp($str, NULL));
var_dump(strcasecmp($str, "0"));
echo "\n--- Testing simple and complex syntax strings ---\n";
$str = 'world';
/* Simple syntax */
var_dump(strcasecmp("Hello, world", "$str"));
var_dump(strcasecmp("Hello, world'S", "$str'S"));
var_dump(strcasecmp("Hello, worldS", "$strS"));
/* String with curly braces, complex syntax */
var_dump(strcasecmp("Hello, worldS", "${str}S"));
var_dump(strcasecmp("Hello, worldS", "{$str}S"));
echo "\n--- Testing binary safe and binary chars ---\n";
var_dump(strcasecmp("Hello\0world", "Hello"));
var_dump(strcasecmp("Hello\0world", "Helloworld"));
var_dump(strcasecmp("\x0", "\0"));
var_dump(strcasecmp("\000", "\0"));
var_dump(strcasecmp("\x00", ""));
var_dump(strcasecmp("\x00", NULL));
var_dump(strcasecmp("\000", NULL));
echo "\n--- Comparing long float values ---\n";
/* Here two different outputs, which depends on the rounding value
before converting to string. Here Precision = 12 */
var_dump(strcasecmp(10.55555555555555555555555555, 10.5555555556)); // int(0)
var_dump(strcasecmp(10.55555555555555555555555555, 10.555555556)); // int(-1)
var_dump(strcasecmp(10.55555555595555555555555555, 10.555555556)); // int(0)
echo "\n--- checking error conditions ---\n";
strcasecmp();
strcasecmp("");
strcasecmp("HI");
strcasecmp("Hi", "Hello", "World");
echo "Done\n";
?>
--EXPECTF--
#### Basic and Possible operations ####
*** comparing the strings in an
Array
(
[0] => a
[1] => A
[2] =>
[3] => ÿ
[4] =>
)
Iteration 0
- strcasecmp of 'a' and 'a' is => int(0)
- strcasecmp of 'a' and 'A' is => int(0)
- strcasecmp of 'a' and '' is => int(-%d)
- strcasecmp of 'a' and 'ÿ' is => int(-%d)
- strcasecmp of 'a' and '
Iteration 1
- strcasecmp of 'A' and 'a' is => int(0)
- strcasecmp of 'A' and 'A' is => int(0)
- strcasecmp of 'A' and '' is => int(-%d)
- strcasecmp of 'A' and 'ÿ' is => int(-%d)
- strcasecmp of 'A' and '
Iteration 2
- strcasecmp of '' and 'a' is => int(%d)
- strcasecmp of '' and 'A' is => int(%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and 'ÿ' is => int(-%d)
- strcasecmp of '' and '
Iteration 3
- strcasecmp of 'ÿ' and 'a' is => int(%d)
- strcasecmp of 'ÿ' and 'A' is => int(%d)
- strcasecmp of 'ÿ' and '' is => int(%d)
- strcasecmp of 'ÿ' and 'ÿ' is => int(0)
- strcasecmp of 'ÿ' and '
Iteration 4
- strcasecmp of '
- strcasecmp of '
- strcasecmp of '
- strcasecmp of '
- strcasecmp of '
*** comparing the strings in an
Array
(
[0] => acc
[1] => Acc
[2] => aC
[3] => acCc
[4] => acd
[5] => ?acc
[6] => Acc!
[7] => $!acc
[8] => ;acc
)
Iteration 0
- strcasecmp of 'acc' and 'acc' is => int(0)
- strcasecmp of 'acc' and 'Acc' is => int(0)
- strcasecmp of 'acc' and 'aC' is => int(%d)
- strcasecmp of 'acc' and 'acCc' is => int(-%d)
- strcasecmp of 'acc' and 'acd' is => int(-%d)
- strcasecmp of 'acc' and '?acc' is => int(%d)
- strcasecmp of 'acc' and 'Acc!' is => int(-%d)
- strcasecmp of 'acc' and '$!acc' is => int(%d)
- strcasecmp of 'acc' and ';acc' is => int(%d)
Iteration 1
- strcasecmp of 'Acc' and 'acc' is => int(0)
- strcasecmp of 'Acc' and 'Acc' is => int(0)
- strcasecmp of 'Acc' and 'aC' is => int(%d)
- strcasecmp of 'Acc' and 'acCc' is => int(-%d)
- strcasecmp of 'Acc' and 'acd' is => int(-%d)
- strcasecmp of 'Acc' and '?acc' is => int(%d)
- strcasecmp of 'Acc' and 'Acc!' is => int(-%d)
- strcasecmp of 'Acc' and '$!acc' is => int(%d)
- strcasecmp of 'Acc' and ';acc' is => int(%d)
Iteration 2
- strcasecmp of 'aC' and 'acc' is => int(-%d)
- strcasecmp of 'aC' and 'Acc' is => int(-%d)
- strcasecmp of 'aC' and 'aC' is => int(0)
- strcasecmp of 'aC' and 'acCc' is => int(-%d)
- strcasecmp of 'aC' and 'acd' is => int(-%d)
- strcasecmp of 'aC' and '?acc' is => int(%d)
- strcasecmp of 'aC' and 'Acc!' is => int(-%d)
- strcasecmp of 'aC' and '$!acc' is => int(%d)
- strcasecmp of 'aC' and ';acc' is => int(%d)
Iteration 3
- strcasecmp of 'acCc' and 'acc' is => int(%d)
- strcasecmp of 'acCc' and 'Acc' is => int(%d)
- strcasecmp of 'acCc' and 'aC' is => int(%d)
- strcasecmp of 'acCc' and 'acCc' is => int(0)
- strcasecmp of 'acCc' and 'acd' is => int(-%d)
- strcasecmp of 'acCc' and '?acc' is => int(%d)
- strcasecmp of 'acCc' and 'Acc!' is => int(%d)
- strcasecmp of 'acCc' and '$!acc' is => int(%d)
- strcasecmp of 'acCc' and ';acc' is => int(%d)
Iteration 4
- strcasecmp of 'acd' and 'acc' is => int(%d)
- strcasecmp of 'acd' and 'Acc' is => int(%d)
- strcasecmp of 'acd' and 'aC' is => int(%d)
- strcasecmp of 'acd' and 'acCc' is => int(%d)
- strcasecmp of 'acd' and 'acd' is => int(0)
- strcasecmp of 'acd' and '?acc' is => int(%d)
- strcasecmp of 'acd' and 'Acc!' is => int(%d)
- strcasecmp of 'acd' and '$!acc' is => int(%d)
- strcasecmp of 'acd' and ';acc' is => int(%d)
Iteration 5
- strcasecmp of '?acc' and 'acc' is => int(-%d)
- strcasecmp of '?acc' and 'Acc' is => int(-%d)
- strcasecmp of '?acc' and 'aC' is => int(-%d)
- strcasecmp of '?acc' and 'acCc' is => int(-%d)
- strcasecmp of '?acc' and 'acd' is => int(-%d)
- strcasecmp of '?acc' and '?acc' is => int(0)
- strcasecmp of '?acc' and 'Acc!' is => int(-%d)
- strcasecmp of '?acc' and '$!acc' is => int(%d)
- strcasecmp of '?acc' and ';acc' is => int(%d)
Iteration 6
- strcasecmp of 'Acc!' and 'acc' is => int(%d)
- strcasecmp of 'Acc!' and 'Acc' is => int(%d)
- strcasecmp of 'Acc!' and 'aC' is => int(%d)
- strcasecmp of 'Acc!' and 'acCc' is => int(-%d)
- strcasecmp of 'Acc!' and 'acd' is => int(-%d)
- strcasecmp of 'Acc!' and '?acc' is => int(%d)
- strcasecmp of 'Acc!' and 'Acc!' is => int(0)
- strcasecmp of 'Acc!' and '$!acc' is => int(%d)
- strcasecmp of 'Acc!' and ';acc' is => int(%d)
Iteration 7
- strcasecmp of '$!acc' and 'acc' is => int(-%d)
- strcasecmp of '$!acc' and 'Acc' is => int(-%d)
- strcasecmp of '$!acc' and 'aC' is => int(-%d)
- strcasecmp of '$!acc' and 'acCc' is => int(-%d)
- strcasecmp of '$!acc' and 'acd' is => int(-%d)
- strcasecmp of '$!acc' and '?acc' is => int(-%d)
- strcasecmp of '$!acc' and 'Acc!' is => int(-%d)
- strcasecmp of '$!acc' and '$!acc' is => int(0)
- strcasecmp of '$!acc' and ';acc' is => int(-%d)
Iteration 8
- strcasecmp of ';acc' and 'acc' is => int(-%d)
- strcasecmp of ';acc' and 'Acc' is => int(-%d)
- strcasecmp of ';acc' and 'aC' is => int(-%d)
- strcasecmp of ';acc' and 'acCc' is => int(-%d)
- strcasecmp of ';acc' and 'acd' is => int(-%d)
- strcasecmp of ';acc' and '?acc' is => int(-%d)
- strcasecmp of ';acc' and 'Acc!' is => int(-%d)
- strcasecmp of ';acc' and '$!acc' is => int(%d)
- strcasecmp of ';acc' and ';acc' is => int(0)
*** comparing the strings in an
Array
(
[0] => 1
[1] => 0
[2] => 0
[3] => -1
[4] => -1
[5] =>
[6] =>
[7] =>
[8] => 1
[9] => 1
[10] =>
[11] => string
)
Iteration 0
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '0' is => int(%d)
- strcasecmp of '1' and '0' is => int(%d)
- strcasecmp of '1' and '-1' is => int(%d)
- strcasecmp of '1' and '-1' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and 'string' is => int(-%d)
Iteration 1
- strcasecmp of '0' and '1' is => int(-%d)
- strcasecmp of '0' and '0' is => int(0)
- strcasecmp of '0' and '0' is => int(0)
- strcasecmp of '0' and '-1' is => int(%d)
- strcasecmp of '0' and '-1' is => int(%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and '1' is => int(-%d)
- strcasecmp of '0' and '1' is => int(-%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and 'string' is => int(-%d)
Iteration 2
- strcasecmp of '0' and '1' is => int(-%d)
- strcasecmp of '0' and '0' is => int(0)
- strcasecmp of '0' and '0' is => int(0)
- strcasecmp of '0' and '-1' is => int(%d)
- strcasecmp of '0' and '-1' is => int(%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and '1' is => int(-%d)
- strcasecmp of '0' and '1' is => int(-%d)
- strcasecmp of '0' and '' is => int(%d)
- strcasecmp of '0' and 'string' is => int(-%d)
Iteration 3
- strcasecmp of '-1' and '1' is => int(-%d)
- strcasecmp of '-1' and '0' is => int(-%d)
- strcasecmp of '-1' and '0' is => int(-%d)
- strcasecmp of '-1' and '-1' is => int(0)
- strcasecmp of '-1' and '-1' is => int(0)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and '1' is => int(-%d)
- strcasecmp of '-1' and '1' is => int(-%d)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and 'string' is => int(-%d)
Iteration 4
- strcasecmp of '-1' and '1' is => int(-%d)
- strcasecmp of '-1' and '0' is => int(-%d)
- strcasecmp of '-1' and '0' is => int(-%d)
- strcasecmp of '-1' and '-1' is => int(0)
- strcasecmp of '-1' and '-1' is => int(0)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and '1' is => int(-%d)
- strcasecmp of '-1' and '1' is => int(-%d)
- strcasecmp of '-1' and '' is => int(%d)
- strcasecmp of '-1' and 'string' is => int(-%d)
Iteration 5
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and 'string' is => int(-%d)
Iteration 6
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and 'string' is => int(-%d)
Iteration 7
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and 'string' is => int(-%d)
Iteration 8
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '0' is => int(%d)
- strcasecmp of '1' and '0' is => int(%d)
- strcasecmp of '1' and '-1' is => int(%d)
- strcasecmp of '1' and '-1' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and 'string' is => int(-%d)
Iteration 9
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '0' is => int(%d)
- strcasecmp of '1' and '0' is => int(%d)
- strcasecmp of '1' and '-1' is => int(%d)
- strcasecmp of '1' and '-1' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '1' is => int(0)
- strcasecmp of '1' and '' is => int(%d)
- strcasecmp of '1' and 'string' is => int(-%d)
Iteration 10
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '0' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '-1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '1' is => int(-%d)
- strcasecmp of '' and '' is => int(0)
- strcasecmp of '' and 'string' is => int(-%d)
Iteration 11
- strcasecmp of 'string' and '1' is => int(%d)
- strcasecmp of 'string' and '0' is => int(%d)
- strcasecmp of 'string' and '0' is => int(%d)
- strcasecmp of 'string' and '-1' is => int(%d)
- strcasecmp of 'string' and '-1' is => int(%d)
- strcasecmp of 'string' and '' is => int(%d)
- strcasecmp of 'string' and '' is => int(%d)
- strcasecmp of 'string' and '' is => int(%d)
- strcasecmp of 'string' and '1' is => int(%d)
- strcasecmp of 'string' and '1' is => int(%d)
- strcasecmp of 'string' and '' is => int(%d)
- strcasecmp of 'string' and 'string' is => int(0)
*** comparing the strings in an
Array
(
[0] => 10.5
[1] => 1.5
[2] => 9.5
[3] => 11.5
[4] => 100.5
[5] => 105
[6] => -10.5
[7] => 10
[8] => 0.5
)
Iteration 0
- strcasecmp of '10.5' and '10.5' is => int(0)
- strcasecmp of '10.5' and '1.5' is => int(%d)
- strcasecmp of '10.5' and '9.5' is => int(-%d)
- strcasecmp of '10.5' and '11.5' is => int(-%d)
- strcasecmp of '10.5' and '100.5' is => int(-%d)
- strcasecmp of '10.5' and '105' is => int(-%d)
- strcasecmp of '10.5' and '-10.5' is => int(%d)
- strcasecmp of '10.5' and '10' is => int(%d)
- strcasecmp of '10.5' and '0.5' is => int(%d)
Iteration 1
- strcasecmp of '1.5' and '10.5' is => int(-%d)
- strcasecmp of '1.5' and '1.5' is => int(0)
- strcasecmp of '1.5' and '9.5' is => int(-%d)
- strcasecmp of '1.5' and '11.5' is => int(-%d)
- strcasecmp of '1.5' and '100.5' is => int(-%d)
- strcasecmp of '1.5' and '105' is => int(-%d)
- strcasecmp of '1.5' and '-10.5' is => int(%d)
- strcasecmp of '1.5' and '10' is => int(-%d)
- strcasecmp of '1.5' and '0.5' is => int(%d)
Iteration 2
- strcasecmp of '9.5' and '10.5' is => int(%d)
- strcasecmp of '9.5' and '1.5' is => int(%d)
- strcasecmp of '9.5' and '9.5' is => int(0)
- strcasecmp of '9.5' and '11.5' is => int(%d)
- strcasecmp of '9.5' and '100.5' is => int(%d)
- strcasecmp of '9.5' and '105' is => int(%d)
- strcasecmp of '9.5' and '-10.5' is => int(%d)
- strcasecmp of '9.5' and '10' is => int(%d)
- strcasecmp of '9.5' and '0.5' is => int(%d)
Iteration 3
- strcasecmp of '11.5' and '10.5' is => int(%d)
- strcasecmp of '11.5' and '1.5' is => int(%d)
- strcasecmp of '11.5' and '9.5' is => int(-%d)
- strcasecmp of '11.5' and '11.5' is => int(0)
- strcasecmp of '11.5' and '100.5' is => int(%d)
- strcasecmp of '11.5' and '105' is => int(%d)
- strcasecmp of '11.5' and '-10.5' is => int(%d)
- strcasecmp of '11.5' and '10' is => int(%d)
- strcasecmp of '11.5' and '0.5' is => int(%d)
Iteration 4
- strcasecmp of '100.5' and '10.5' is => int(%d)
- strcasecmp of '100.5' and '1.5' is => int(%d)
- strcasecmp of '100.5' and '9.5' is => int(-%d)
- strcasecmp of '100.5' and '11.5' is => int(-%d)
- strcasecmp of '100.5' and '100.5' is => int(0)
- strcasecmp of '100.5' and '105' is => int(-%d)
- strcasecmp of '100.5' and '-10.5' is => int(%d)
- strcasecmp of '100.5' and '10' is => int(%d)
- strcasecmp of '100.5' and '0.5' is => int(%d)
Iteration 5
- strcasecmp of '105' and '10.5' is => int(%d)
- strcasecmp of '105' and '1.5' is => int(%d)
- strcasecmp of '105' and '9.5' is => int(-%d)
- strcasecmp of '105' and '11.5' is => int(-%d)
- strcasecmp of '105' and '100.5' is => int(%d)
- strcasecmp of '105' and '105' is => int(0)
- strcasecmp of '105' and '-10.5' is => int(%d)
- strcasecmp of '105' and '10' is => int(%d)
- strcasecmp of '105' and '0.5' is => int(%d)
Iteration 6
- strcasecmp of '-10.5' and '10.5' is => int(-%d)
- strcasecmp of '-10.5' and '1.5' is => int(-%d)
- strcasecmp of '-10.5' and '9.5' is => int(-%d)
- strcasecmp of '-10.5' and '11.5' is => int(-%d)
- strcasecmp of '-10.5' and '100.5' is => int(-%d)
- strcasecmp of '-10.5' and '105' is => int(-%d)
- strcasecmp of '-10.5' and '-10.5' is => int(0)
- strcasecmp of '-10.5' and '10' is => int(-%d)
- strcasecmp of '-10.5' and '0.5' is => int(-%d)
Iteration 7
- strcasecmp of '10' and '10.5' is => int(-%d)
- strcasecmp of '10' and '1.5' is => int(%d)
- strcasecmp of '10' and '9.5' is => int(-%d)
- strcasecmp of '10' and '11.5' is => int(-%d)
- strcasecmp of '10' and '100.5' is => int(-%d)
- strcasecmp of '10' and '105' is => int(-%d)
- strcasecmp of '10' and '-10.5' is => int(%d)
- strcasecmp of '10' and '10' is => int(0)
- strcasecmp of '10' and '0.5' is => int(%d)
Iteration 8
- strcasecmp of '0.5' and '10.5' is => int(-%d)
- strcasecmp of '0.5' and '1.5' is => int(-%d)
- strcasecmp of '0.5' and '9.5' is => int(-%d)
- strcasecmp of '0.5' and '11.5' is => int(-%d)
- strcasecmp of '0.5' and '100.5' is => int(-%d)
- strcasecmp of '0.5' and '105' is => int(-%d)
- strcasecmp of '0.5' and '-10.5' is => int(%d)
- strcasecmp of '0.5' and '10' is => int(-%d)
- strcasecmp of '0.5' and '0.5' is => int(0)
#### Testing Miscelleneous inputs ####
--- Testing objects ---
int(-%d)
--- Testing arrays ---
Warning: strcasecmp() expects parameter 2 to be string (Unicode or binary),
array given in %s on line %d
NULL
int(%d)
int(%d)
--- Testing Resources ---
int(0)
int(%d)
--- Testing a longer and heredoc string ---
int(0)
int(-%d)
int(%d)
--- Testing a heredoc null string ---
int(-%d)
int(0)
int(-%d)
--- Testing simple and complex syntax strings ---
int(-%d)
int(-%d)
Notice: Undefined variable: strS in %s on line %d
int(%d)
int(-%d)
int(-%d)
--- Testing binary safe and binary chars ---
int(%d)
int(-%d)
int(0)
int(0)
int(%d)
int(%d)
int(%d)
--- Comparing long float values ---
int(0)
int(-%d)
int(0)
--- checking error conditions ---
Warning: strcasecmp() expects exactly 2 parameters, 0 given in %s on line %d
Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
Warning: strcasecmp() expects exactly 2 parameters, 3 given in %s on line %d
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php