merge
array Set::merge ($arr1, $arr2=null)
This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive. The difference to the two is that if an array key contains another array then the function behaves recursive (unlike array_merge) but does not do if for keys containing strings (unlike array_merge_recursive). See the unit test for more information.
This function will work with an unlimited amount of arguments and typecasts non-array parameters into arrays.
Простой текст$arry1 = array(array('id' => '48c2570e-dfa8-4c32-a35e-0d71cbdd56cb','name' => 'mysql raleigh-workshop-08 < 2008-09-05.sql ','description' => 'Importing an sql dump'),array('id' => '48c257a8-cf7c-4af2-ac2f-114ecbdd56cb','name' => 'pbpaste | grep -i Unpaid | pbcopy','description' => 'Remove all lines that say "Unpaid".',));$arry2 = 4;$arry3 = "This is a String";$arry3 = array(0=>"test array", "cats"=>"dogs");$res = Set::merge($arry1, $arry2, $arry3);/* $res now looks like:Array([0] => Array([id] => 48c2570e-dfa8-4c32-a35e-0d71cbdd56cb[name] => mysql raleigh-workshop-08 < 2008-09-05.sql[description] => Importing an sql dump)[1] => Array([id] => 48c257a8-cf7c-4af2-ac2f-114ecbdd56cb[name] => pbpaste | grep -i Unpaid | pbcopy[description] => Remove all lines that say "Unpaid".)[2] => 4[3] => test array[cats] => dogs)*/


Коментарии:
Добавить коментарий