1--TEST-- 2Test ord() function : basic functionality 3--FILE-- 4<?php 5 6/* Prototype : int ord ( string $string ) 7 * Description: Return ASCII value of character 8 * Source code: ext/standard/string.c 9*/ 10 11echo "*** Testing ord() : basic functionality ***\n"; 12 13var_dump(ord("a")); 14var_dump(ord("z")); 15var_dump(ord("0")); 16var_dump(ord("9")); 17var_dump(ord("!")); 18var_dump(ord("*")); 19var_dump(ord("@")); 20var_dump(ord("\n")); 21var_dump(ord("\x0A")); 22var_dump(ord("\xFF")); 23var_dump(ord("Hello")); 24 25// Make sure all valid ascii chars round trip 26for ($i = 0; $i < 255; $i++) { 27 if (ord(chr($i)) != $i) { 28 exit("TEST FAILED: $i does not round trip\n"); 29 } 30} 31 32?> 33===DONE=== 34--EXPECT-- 35*** Testing ord() : basic functionality *** 36int(97) 37int(122) 38int(48) 39int(57) 40int(33) 41int(42) 42int(64) 43int(10) 44int(10) 45int(255) 46int(72) 47===DONE=== 48