note 90083 rejected from language.operators.errorcontrol by danbrown

From: Date: Sun, 05 Apr 2009 18:46:41 +0000
Subject: note 90083 rejected from language.operators.errorcontrol by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152837@lists.php.net to get a copy of this message
Note Submitter: cFreed at orange dot fr ---- The manual says: "A simple rule of thumb is: if you can take the value of something, you can prepend the @ operator to it." This is not always true. As shown by the example given, this works, assuming $cache IS AN ARRAY: <?php $value = @$cache[$key]; // will not issue a notice if the index $key doesn't exist. ?> But it does not work if $cache IS A STRING, and $key is an integer higher than strlen($cache)-1. in other words: <?php $str='abc'; $value=@$str[5]; // will issue the notice "Uninitialized string offset 5 in...". ?>

« previous php.notes (#152837) next »