note 119421 added to function.strval

From: Date: Thu, 02 Jun 2016 13:17:20 +0000
Subject: note 119421 added to function.strval
Groups: php.notes 
Request: Send a blank email to php-notes+get-205642@lists.php.net to get a copy of this message
Some notes about how this function has changed over time, with regards the following statement: > You cannot use strval() on arrays or on objects that > do not implement the __toString() method. == Arrays == In PHP 5.3 and below, strval(array(1, 2, 3)) would return the string "Array" without any sort of error occurring. From 5.4 and above, the return value is unchanged but you will now get a notice-level error: "Array to string conversion". == Objects == For objects that do not implement __toString(), the behaviour has varied: PHP 4: "Object" PHP 5 < 5.2: "Object id #1" (number obviously varies) PHP >= 5.2: Catchable fatal error: Object of class X could not be converted to string ---- Server IP: 83.137.20.135 Probable Submitter: 94.173.175.211 ---- Manual Page -- http://php.net/manual/en/function.strval.php Edit -- https://master.php.net/note/edit/119421 Del: integrated -- https://master.php.net/note/delete/119421/integrated Del: useless -- https://master.php.net/note/delete/119421/useless Del: bad code -- https://master.php.net/note/delete/119421/bad+code Del: spam -- https://master.php.net/note/delete/119421/spam Del: non-english -- https://master.php.net/note/delete/119421/non-english Del: in docs -- https://master.php.net/note/delete/119421/in+docs Del: other reasons-- https://master.php.net/note/delete/119421 Reject -- https://master.php.net/note/reject/119421 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205642) next »