sometimes a cigar is just a cigar
Header image

Adding two array

Posted by ALonon in Php

To add a array with a array, you can use array_combine(),but to use this function arrays size must be same.
for example:

$array1=array(1,4,5,6);
$array2=array(A,K,M,P);
$array3= array_combine($array1,$array2);

//array3 will be
$array3=
array(
[1]=>A,
[4]=>K,
[5]=>M,
[6]=>P,
)

for more information you can visit php.net/array_combine

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>