note 40250 added to language.types.string
| From: | maka3d at yahoo dot com dot br | Date: | Thu, 26 Feb 2004 15:46:04 +0000 |
| Subject: | note 40250 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65804@lists.php.net to get a copy of this message | ||
Remember that even PHP is type less, some convertions like INTEGER to STRING is not done when using
character direct access like string functions does.
<?php
$str = '456';
echo strlen($str); // strlen convert int to string automatically
echo $str{0}; // this works
$str = 456;
echo $str{0}; // this NOT works
$str = (string)$str; // do type cast to string
echo $str{1}; // now it works
?>
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40250
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40250&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40250&report=yes
Search -- http://master.php.net/manage/user-notes.php