MemoryRefresh!

Variables / Type casting   Type casting



Questions Answers 0%

Pages   0 from 91
Questions   0 from 142

Reset


Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast.
<?php $arr1 = array(1, 2, 3); $arr2 = (string) $arr1; var_dump($arr1); // array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } var_dump($arr2); // string(5) "Array" php.net

Related Pages

Definition
Variable
Check
Type casting
Array to object
New object


0% 100%
 
 
0 pages 91 pages
1) How do you change $a = 10 to boolean type?





2) Which is incorect?








Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast.
<?php $arr1 = array(1, 2, 3); $arr2 = (string) $arr1; var_dump($arr1); // array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } var_dump($arr2); // string(5) "Array" php.net

References









Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References