3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = array( array('Pedigree Dry', 'N/A', 'N/A', 'N/A'), array('Professional Range', 'N/A', 'N/A', 'N/A'), array('Pedigree Wet', 'N/A', 'N/A', 'N/A'), array('PMM', 'N/A', 'N/A', 'N/A'), array('Chappi', 'N/A', 'N/A', 'N/A'), array('Care & Treat', 'N/A', 'N/A', 'N/A'), array('Sheba', 'N/A', 'N/A', 'N/A'), array('Whiskas Dry', 'N/A', 'N/A', 'N/A'), array('Whiskas Wet', 'N/A', 'N/A', 'N/A'), ); $newArray = array(); foreach($data as $inner_array) { $newArray[] = str_replace("N/A", 0, $inner_array); } print_r($newArray);
based on ZMZYJ
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [0] => Pedigree Dry [1] => 0 [2] => 0 [3] => 0 ) [1] => Array ( [0] => Professional Range [1] => 0 [2] => 0 [3] => 0 ) [2] => Array ( [0] => Pedigree Wet [1] => 0 [2] => 0 [3] => 0 ) [3] => Array ( [0] => PMM [1] => 0 [2] => 0 [3] => 0 ) [4] => Array ( [0] => Chappi [1] => 0 [2] => 0 [3] => 0 ) [5] => Array ( [0] => Care & Treat [1] => 0 [2] => 0 [3] => 0 ) [6] => Array ( [0] => Sheba [1] => 0 [2] => 0 [3] => 0 ) [7] => Array ( [0] => Whiskas Dry [1] => 0 [2] => 0 [3] => 0 ) [8] => Array ( [0] => Whiskas Wet [1] => 0 [2] => 0 [3] => 0 ) )