note 90685 added to function.is-scalar

From: Date: Mon, 04 May 2009 19:15:33 +0000
Subject: note 90685 added to function.is-scalar
Groups: php.notes 
Request: Send a blank email to php-notes+get-154203@lists.php.net to get a copy of this message
Here's a little function that will test whether a variable can be used as offset to an array. <?php function is_offset(&$var) { return (is_scalar($var) || is_null($var)) && !is_resource($var); } ?> The resource check is currently redundant, but according to the manual that may change in the future. ---- Server IP: 213.249.64.162 Probable Submitter: 82.92.197.212 ---- Manual Page -- http://www.php.net/manual/en/function.is-scalar.php Edit -- https://master.php.net/note/edit/90685 Del: integrated -- https://master.php.net/note/delete/90685/integrated Del: useless -- https://master.php.net/note/delete/90685/useless Del: bad code -- https://master.php.net/note/delete/90685/bad+code Del: spam -- https://master.php.net/note/delete/90685/spam Del: non-english -- https://master.php.net/note/delete/90685/non-english Del: in docs -- https://master.php.net/note/delete/90685/in+docs Del: other reasons-- https://master.php.net/note/delete/90685 Reject -- https://master.php.net/note/reject/90685 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#154203) next »