note 75587 deleted from function.is-string by danbrown
| From: | danbrown@php.net | Date: | Mon, 01 Nov 2010 14:09:11 +0000 |
| Subject: | note 75587 deleted from function.is-string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173653@lists.php.net to get a copy of this message | ||
Note Submitter: php dot net at oui dot jp
----
<?php
// Interesting...
$arr = array ('abc','def','ghi');
$aarr = array ('0' => 'abc','1' =>
'def','2' => 'ghi');
foreach ($arr as $u => $v)
print is_string($u) ? "Yes\n":"no\n"; // no: ok, index is numeric (0,
1, 2)
foreach ($aarr as $u => $v)
print is_string($u) ? "Yes\n":"no\n"; // still no! was expecting Yes!
if (is_string ('0')) print "'0' is a string\n"; // ...as
'0' is a string!
?>