Memory Refresh
Php



Type casting





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/manual/en/language.types.type-juggling.php#language.types.typecasting