- array_map: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
- sprintf: documentation ( source)
<?php
$code = array_map(
function ($line) {
return $line ? ' '.$line : $line;
},
explode("\n", $code)
);
return sprintf(
"if (%s)\n{\n%s}\n",
implode(' && ', $conditions),
$code
);