note 90685 deleted from function.is-scalar by sobak
| From: | sobak@php.net | Date: | Sat, 19 Nov 2016 05:43:37 +0000 |
| Subject: | note 90685 deleted from function.is-scalar by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207180@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at oehoeboeroe dot nl
----
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.