[PHP-NOTES] note 130527 added to function.settype

[email protected] ("[email protected]") Wed, 22 Oct 2025 09:24:56 +0000
Newsgroups php.notes
Message-ID <[email protected]>
the usefulness of this function is to use it in combination with gettype (for dynamic typecasting from external sources)
<?php 
$target_type = gettype($this->$var_name);
settype($var_val, $target_type);// force the expected type
$this->$var_name = $var_val;
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 194.153.204.210)
----
Manual Page -- https://php.net/manual/en/function.settype.php
Edit        -- https://main.php.net/note/edit/130527
Del: integrated  -- https://main.php.net/note/delete/130527/integrated
Del: useless     -- https://main.php.net/note/delete/130527/useless
Del: bad code    -- https://main.php.net/note/delete/130527/bad+code
Del: spam        -- https://main.php.net/note/delete/130527/spam
Del: non-english -- https://main.php.net/note/delete/130527/non-english
Del: in docs     -- https://main.php.net/note/delete/130527/in+docs
Del: other reasons-- https://main.php.net/note/delete/130527
Reject      -- https://main.php.net/note/reject/130527
Search      -- https://main.php.net/manage/user-notes.php