1--TEST-- 2Test ctype_digit() function : usage variations - octal and hexadecimal values 3--SKIPIF-- 4<?php require_once('skipif.inc'); ?> 5--FILE-- 6<?php 7/* Prototype : bool ctype_digit(mixed $c) 8 * Description: Checks for numeric character(s) 9 * Source code: ext/ctype/ctype.c 10 */ 11 12/* 13 * Pass octal and hexadecimal values as $c argument to ctype_digit() to test behaviour 14 */ 15 16echo "*** Testing ctype_digit() : usage variations ***\n"; 17 18$orig = setlocale(LC_CTYPE, "C"); 19 20$octal_values = array(061, 062, 063, 064); 21$hex_values = array (0x31, 0x32, 0x33, 0x34); 22 23echo "\n-- Octal Values --\n"; 24$iterator = 1; 25foreach($octal_values as $c) { 26 echo "-- Iteration $iterator --\n"; 27 var_dump(ctype_digit($c)); 28 $iterator++; 29} 30 31echo "\n-- Hexadecimal Values --\n"; 32$iterator = 1; 33foreach($hex_values as $c) { 34 echo "-- Iteration $iterator --\n"; 35 var_dump(ctype_digit($c)); 36 $iterator++; 37} 38 39setlocale(LC_CTYPE, $orig); 40?> 41===DONE=== 42--EXPECTF-- 43*** Testing ctype_digit() : usage variations *** 44 45-- Octal Values -- 46-- Iteration 1 -- 47bool(true) 48-- Iteration 2 -- 49bool(true) 50-- Iteration 3 -- 51bool(true) 52-- Iteration 4 -- 53bool(true) 54 55-- Hexadecimal Values -- 56-- Iteration 1 -- 57bool(true) 58-- Iteration 2 -- 59bool(true) 60-- Iteration 3 -- 61bool(true) 62-- Iteration 4 -- 63bool(true) 64===DONE=== 65