implode - Imploding in PHP -
i have array having various numbers:
$array = [1,2,3,4]; i have code extract values , prepend 'ad' them while imploding html attribute:
<div class="ad1 ad2 ad3"> how can that?
loop on array, , whatever have to:
foreach ($array $item) { ... } in exemple:
$classname = ""; foreach ($array $item) { $classname .= "ad".$item." "; } echo '<div class="'.$classname.'">'; php implode
No comments:
Post a Comment