The idea behind writing a post to return data from loop in function in PHP just came into my mind because a fresher was trying to set up a function to return data from loop and hoping it would then run a return each time within the loop and the function would echo each out one by one.

Read More

How to check a value exists in an array is a general requirement when using array. We can do it by iterating through the array one by one and checking that the searched value exist or not. But now a days, everybody expects a short method means using built in functions in the language.

Read More

The array_merge() function merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.

<?php
$A1=array("apple","papaya");
$A2=array("banana","grapes");
print_r(array_merge($A1,$A2));
?> 

Output would be :
Array ( [0] => apple[1] => papaya[2] => banana [3] => grapes ) 

Read More

[ Page 3 of 3 ]