ctype_xdigit_variation4.phpt [plain text]
--TEST--
Test ctype_xdigit() function : usage variations - heaxadecimal and octal values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
echo "*** Testing ctype_xdigit() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
$octal_values1 = array(012, 013, 014, 015);
$octal_values2 = array(061, 062, 063, 064);
$hex_values1 = array(0x1A, 0x1B, 0x1C, 0x1D);
$hex_values2 = array(0x61, 0x62, 0x63, 0x64);
echo "\n-- Octal values --\n";
echo "'Incorrect' Integers: \n";
foreach($octal_values1 as $c) {
var_dump(ctype_xdigit($c));
}
echo "'Correct' Integers: \n";
foreach($octal_values2 as $c) {
var_dump(ctype_xdigit($c));
}
echo "\n-- Hexadecimal values --\n";
echo "'Incorrect' Integers: \n";
foreach($hex_values1 as $c) {
var_dump(ctype_xdigit($c));
}
echo "'Correct' Integers: \n";
foreach($hex_values2 as $c) {
var_dump(ctype_xdigit($c));
}
setlocale(LC_CTYPE, $orig);
?>
===DONE===
--EXPECTF--
*** Testing ctype_xdigit() : usage variations ***
-- Octal values --
'Incorrect' Integers:
bool(false)
bool(false)
bool(false)
bool(false)
'Correct' Integers:
bool(true)
bool(true)
bool(true)
bool(true)
-- Hexadecimal values --
'Incorrect' Integers:
bool(false)
bool(false)
bool(false)
bool(false)
'Correct' Integers:
bool(true)
bool(true)
bool(true)
bool(true)
===DONE===