note 65237 added to function.settype
| From: | php-general at lists dot php dot net | Date: | Thu, 27 Apr 2006 11:29:34 +0000 |
| Subject: | note 65237 added to function.settype | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-109847@lists.php.net to get a copy of this message | ||
As per Ludwig's suggestion, settype can be used via call_user_func, keeping in mind, however,
that it must be passed by reference:
<?php
$a = 123;
$b = "string";
call_user_func("settype", &$a, &$b);
var_dump($a); // string(3) "123"
?>
As with other functions, you can also define settype dynamically:
<?php
$a = 123;
$b = "string";
$set = "settype";
$set($a, $b);
var_dump($a); // string(3) "123"
?>
----
Server IP: 61.129.33.155
Probable Submitter: 218.17.94.14
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.settype.php
Edit -- http://master.php.net/note/edit/65237
Del: integrated -- http://master.php.net/note/delete/65237/integrated
Del: useless -- http://master.php.net/note/delete/65237/useless
Del: bad code -- http://master.php.net/note/delete/65237/bad+code
Del: spam -- http://master.php.net/note/delete/65237/spam
Del: non-english -- http://master.php.net/note/delete/65237/non-english
Del: in docs -- http://master.php.net/note/delete/65237/in+docs
Del: other reasons-- http://master.php.net/note/delete/65237
Reject -- http://master.php.net/note/reject/65237
Search -- http://master.php.net/manage/user-notes.php