????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.148.200.70 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 : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/array/ |
Upload File : |
--TEST-- Test sizeof() function : object functionality - objects without Countable interface --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() */ echo "*** Testing sizeof() : object functionality ***\n"; echo "--- Testing sizeof() with objects which doesn't implement Countable interface ---\n"; // class without member class test { // no members } // class with only members and with out member functions class test1 { public $member1; var $var1; private $member2; protected $member3; // no member functions } // class with only member functions class test2 { // no data members public function display() { echo " Class Name : test2\n"; } } // child class which inherits parent test2 class child_test2 extends test2 { public $child_member1; private $child_member2; } // abstract class abstract class abstract_class { public $member1; private $member2; abstract protected function display(); } // implement abstract 'abstract_class' class class concrete_class extends abstract_class { protected function display() { echo " class name is : concrete_class \n "; } } $objects = array ( /* 1 */ new test(), new test1(), new test2(), new child_test2(), /* 5 */ new concrete_class() ); $counter = 1; for($i = 0; $i < count($objects); $i++) { echo "-- Iteration $counter --\n"; $var = $objects[$i]; echo "Default Mode: "; var_dump( sizeof($var) ); echo "\n"; echo "COUNT_NORMAL Mode: "; var_dump( sizeof($var, COUNT_NORMAL) ); echo "\n"; echo "COUNT_RECURSIVE Mode: "; var_dump( sizeof($var, COUNT_RECURSIVE) ); echo "\n"; $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing sizeof() : object functionality *** --- Testing sizeof() with objects which doesn't implement Countable interface --- -- Iteration 1 -- Default Mode: int(1) COUNT_NORMAL Mode: int(1) COUNT_RECURSIVE Mode: int(1) -- Iteration 2 -- Default Mode: int(1) COUNT_NORMAL Mode: int(1) COUNT_RECURSIVE Mode: int(1) -- Iteration 3 -- Default Mode: int(1) COUNT_NORMAL Mode: int(1) COUNT_RECURSIVE Mode: int(1) -- Iteration 4 -- Default Mode: int(1) COUNT_NORMAL Mode: int(1) COUNT_RECURSIVE Mode: int(1) -- Iteration 5 -- Default Mode: int(1) COUNT_NORMAL Mode: int(1) COUNT_RECURSIVE Mode: int(1) Done