Arrays are used to store many values in single variables. Eg. Name of fruits In Php, array can be declared as the following Array($val1, $val2); Please check the following screenshot CODE <?php $fruitNames = array("Grapes","Banana","Papaya","Mango"); echo $fruitNames[0]; ?> OUTPUT IS ...
Home/array
phpsupport | phpsupportdesk Latest Articles
What is the use of explode in PHP?
pHpSupportIn this post you will learn about the use of explode in PHP. Please check the code given below. This will help. PHP Code Explode breaks the string into pieces(array) $str = “2008/12/10”; // This is a string. I ...
How to convert object into Array – PHP
pHpSupportGenerally we sometimes we got stuck while doing coding. I used this function to easily converting object into array if needed. Hope it will help to someone else. function object_to_array($object){ if(is_array($object) || is_object($object)){ $array = array(); foreach($object as $key => ...