fork download
  1. <?php
  2. $MyArray[0]=Array("id"=>1,"name"=>prophet,"family"=>muhammad);
  3. $MyArray[1]=Array("id"=>1,"name"=>imam,"family"=>ali);
  4. $MyArray[2]=Array("id"=>1,"name"=>imam,"family"=>hossein);
  5.  
  6. foreach($MyArray as $key=>$myarray){
  7. $MyArray[$key]["fullName"] = $myarray["name"]." ".$myarray["family"];
  8. }
  9. var_dump($MyArray);
  10. // your code goes here
Success #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  array(4) {
    ["id"]=>
    int(1)
    ["name"]=>
    string(7) "prophet"
    ["family"]=>
    string(8) "muhammad"
    ["fullName"]=>
    string(16) "prophet muhammad"
  }
  [1]=>
  array(4) {
    ["id"]=>
    int(1)
    ["name"]=>
    string(4) "imam"
    ["family"]=>
    string(3) "ali"
    ["fullName"]=>
    string(8) "imam ali"
  }
  [2]=>
  array(4) {
    ["id"]=>
    int(1)
    ["name"]=>
    string(4) "imam"
    ["family"]=>
    string(7) "hossein"
    ["fullName"]=>
    string(12) "imam hossein"
  }
}
stderr
PHP Notice:  Use of undefined constant prophet - assumed 'prophet' in /home/bdxBZG/prog.php on line 2
PHP Notice:  Use of undefined constant muhammad - assumed 'muhammad' in /home/bdxBZG/prog.php on line 2
PHP Notice:  Use of undefined constant imam - assumed 'imam' in /home/bdxBZG/prog.php on line 3
PHP Notice:  Use of undefined constant ali - assumed 'ali' in /home/bdxBZG/prog.php on line 3
PHP Notice:  Use of undefined constant imam - assumed 'imam' in /home/bdxBZG/prog.php on line 4
PHP Notice:  Use of undefined constant hossein - assumed 'hossein' in /home/bdxBZG/prog.php on line 4