settype (converting variable or string to an array) example

It is used to convert variables into an array.

Syntax:

settype($variable_name,’array’); 

 

Program: settype.php

<?php
$variable=25;
echo "its variable\t=$variable\n\n";
settype($variable,'array');              //variable is converted to an array.
echo "its array\t=$variable[0]\n";
?>

 

Output:

settype

 

 

 

Thanks for reading this post…………!!!

Leave a Reply