note 10007 added to sizeof

From: Date: Wed, 06 Dec 2000 18:06:42 +0000
Subject: note 10007 added to sizeof
Groups: php.notes 
Request: Send a blank email to php-notes+get-8483@lists.php.net to get a copy of this message
Usually sizeof(array array) returns 1, if no element of the array is set. To get 0 as return value, you can use instead: function size_of($check_array) { $assigneditems=sizeof($check_array); if (!isset($check_array[0])) $assigneditems=0; return $assigneditems; } ... $i = size_of($my_array); ... (returns 0 if the array is empty) http://www.php.net/manual/function.sizeof.php

« previous php.notes (#8483) next »