3v4l.org

run code in 200+ 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($array as $inner_array) { $newArray[] = str_replace("N/A", 0, $inner_array); } print_r($newArray);
based on mcf9r
Output for 5.1.0 - 7.2.0
Notice: Undefined variable: array in /in/ZMZYJ on line 14 Warning: Invalid argument supplied for foreach() in /in/ZMZYJ on line 14 Array ( )
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.5
Warning: Invalid argument supplied for foreach() in /in/ZMZYJ on line 14 Array ( )
Output for 4.3.11
Array ( )