- var_export: documentation ( source)
- array_shift: documentation ( source)
- preg_replace: documentation ( source)
<?php
$myArray = ['yellow', 'green', 'red'];
$myString = 'banana is ?, apple is ?, tomato is ?';
do {
$myString = preg_replace(
'/\?/',
array_shift($myArray),
$myString,
1,
$count
);
} while ($count && $myArray);
echo $myString;
echo "\n\n";
var_export($myArray);