Hi to all,
I have two arrays . One array contains field name and another one contain field values. I want make condition "fieldname = fieldvalue" . Is there any PHP built in function available for achieve this?
ex: array1('fieldname1','fieldname2');
array2('fieldvalue1','fieldvalue2');
I want to make "fieldname1 = fieldvalue1, fieldname2 = fieldvalue2". want to just add = between two array values. I dont want to use foreach or for loop for extract array values and concatenate = symbol with aarray value. Is there any PHP built in function available, please send it to this forum..
instead of foreach and for
Moderator: General Moderators
Re: instead of foreach and for
I'm not sure why you want to avoid foreach but this will do it.
Code: Select all
function concat($x, $y)
{
return "$x = $y";
}
$concated = array_map('concat', range(1,5), range(6, 10));
echo "<pre>" . print_r($concated, true) . "</pre>";
Re: instead of foreach and for
Thanks astian..