<?php $data = [['el1','el2'],['el3','el4'],]; function add_el($data,$elem){ foreach($data as $ind=>&$ar){ $ar[] = $elem; } return $data; } $el = 'el new'; print_r(add_el($data,$el));
You have javascript disabled. You will not be able to edit any code.