note 38763 added to function.settype

From: Date: Tue, 06 Jan 2004 12:03:09 +0000
Subject: note 38763 added to function.settype
Groups: php.notes 
Request: Send a blank email to php-notes+get-62995@lists.php.net to get a copy of this message
Note that you don't need to - or rather shouldn't - re-assign the variable of which you're changing the type, as settype() returns boolean true/false: <? $a = "1234"; var_dump($a); // string(4) "1234" settype($a, "int"); var_dump($a); // int(1234) $a = settype($a, "int"); var_dump($a); // bool(true) -> whoops! ?> ---- Manual Page -- http://www.php.net/manual/en/function.settype.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38763 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38763&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38763&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#62995) next »