3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $email_invoices = ''; $x['invoices'] = '1765587|95.37||1407727800,1779463|6.01||1407727800,'; $invoice_bits = explode(',',$x['invoices']); for($i=0; $i<count($invoice_bits)-1; $i++) { $bits = explode('|', $invoice_bits[$i]); $email_invoices .= '<tr> <td style="padding-right: 10px;">'.$bits[0].'</td> <td style="padding-right: 10px;">'.$bits[2].'</td> <td style="padding-right: 10px;">'.$bits[1].'</td> </tr>'; } echo $email_invoices;
based on kuLmD
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<tr> <td style="padding-right: 10px;">1765587</td> <td style="padding-right: 10px;"></td> <td style="padding-right: 10px;">95.37</td> </tr><tr> <td style="padding-right: 10px;">1779463</td> <td style="padding-right: 10px;"></td> <td style="padding-right: 10px;">6.01</td> </tr>