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…………!!!

297 total views, 0 views today

Leave a Reply

Your email address will not be published. Required fields are marked *