3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "Walter Sobchak, 5, 3hp, £50000, £10000, none, 1 Alien, 13, 3hp, £250000, £35000, none, 1 Hit Girl, 12, 3hp, £280000, £29000, Potential, Leader, 1 Dovahkiin, 14, 3hp, £450000, £35000, Special Ability: Fus Ro Dah!, 1 Bub and Bob, 5, 2hp, £100000, £5000, Unique Ability: Bubble Bobble!, 1 Big Daddy, 11, 3hp, £200000, £30000, none, 1 Godzilla, 17, 3hp, £750000, £50000, none, 1 Neo, 14, 3hp, £550000, £38000, Potential, 1 Darth Maul, 14, 3hp, £450000, £30000, none, 1 Tyler Durden, 7, 3hp, £170000, £26000, none, 1 Sin, 18, 1hp, £1100000, £60000, Keeps coming back…, 2 Gypsy Danger, 17, 3hp, £750000, £50000, none, 1 Jaws, 6, 3hp, £100000, £10000, none, 2 The Reapers, 20, 3hp, £1400000, £60000, Unique Ability: You exist because we allow it. And you will die because we demand it, 1 The Wicked Witch of the West, 13, 3hp, £250000, £35000, seeker, 1"; $str = str_replace("hp,",",",$str); $str = str_replace("£","",$str); $str = str_replace(", none","",$str); $sep = explode("\n",$str); $row = ''; for($i=0;$i<count($sep);$i++) { $sep2 = explode(",",$sep[$i]); $name = $sep2[0]; $br = $sep2[1]; $hp = $sep2[2]."hp"; $value = "£".number_format($sep2[3]); $wage = "£".number_format($sep2[4]); if (count($sep2)==6) { $ability1 = $ability2 = ''; $dice = $sep2[5]; } elseif (count($sep2)==7) { $ability1 = $sep2[5]; $ability2 = ''; $dice = $sep2[6]; } elseif (count($sep2)==8) { $ability1 = $sep2[5]; $ability2 = $sep2[6]; $dice = $sep2[7]; } else { print "error"; } $row .= "<dt>$name</dt><dd>$br</dd><dd>$hp</dd><dd>$value</dd><dd>$wage</dd><dd>$ability1</dd><dd>$ability2</dd><dd>$dice</dd>"; } echo "<dl>$row</dl>"; ?>
Output for 4.3.0 - 7.1.0
<dl><dt>Walter Sobchak</dt><dd> 5</dd><dd> 3hp</dd><dd>£50,000</dd><dd>£10,000</dd><dd></dd><dd></dd><dd> 1</dd><dt>Alien</dt><dd> 13</dd><dd> 3hp</dd><dd>£250,000</dd><dd>£35,000</dd><dd></dd><dd></dd><dd> 1</dd><dt>Hit Girl</dt><dd> 12</dd><dd> 3hp</dd><dd>£280,000</dd><dd>£29,000</dd><dd> Potential</dd><dd> Leader</dd><dd> 1</dd><dt>Dovahkiin</dt><dd> 14</dd><dd> 3hp</dd><dd>£450,000</dd><dd>£35,000</dd><dd> Special Ability: Fus Ro Dah!</dd><dd></dd><dd> 1</dd><dt>Bub and Bob</dt><dd> 5</dd><dd> 2hp</dd><dd>£100,000</dd><dd>£5,000</dd><dd> Unique Ability: Bubble Bobble!</dd><dd></dd><dd> 1</dd><dt>Big Daddy</dt><dd> 11</dd><dd> 3hp</dd><dd>£200,000</dd><dd>£30,000</dd><dd></dd><dd></dd><dd> 1</dd><dt>Godzilla</dt><dd> 17</dd><dd> 3hp</dd><dd>£750,000</dd><dd>£50,000</dd><dd></dd><dd></dd><dd> 1</dd><dt>Neo</dt><dd> 14</dd><dd> 3hp</dd><dd>£550,000</dd><dd>£38,000</dd><dd> Potential</dd><dd></dd><dd> 1</dd><dt>Darth Maul</dt><dd> 14</dd><dd> 3hp</dd><dd>£450,000</dd><dd>£30,000</dd><dd></dd><dd></dd><dd> 1</dd><dt>Tyler Durden</dt><dd> 7</dd><dd> 3hp</dd><dd>£170,000</dd><dd>£26,000</dd><dd></dd><dd></dd><dd> 1</dd><dt>Sin</dt><dd> 18</dd><dd> 1hp</dd><dd>£1,100,000</dd><dd>£60,000</dd><dd> Keeps coming back…</dd><dd></dd><dd> 2</dd><dt>Gypsy Danger</dt><dd> 17</dd><dd> 3hp</dd><dd>£750,000</dd><dd>£50,000</dd><dd></dd><dd></dd><dd> 1</dd><dt>Jaws</dt><dd> 6</dd><dd> 3hp</dd><dd>£100,000</dd><dd>£10,000</dd><dd></dd><dd></dd><dd> 2</dd><dt>The Reapers</dt><dd> 20</dd><dd> 3hp</dd><dd>£1,400,000</dd><dd>£60,000</dd><dd> Unique Ability: You exist because we allow it. And you will die because we demand it</dd><dd></dd><dd> 1</dd><dt>The Wicked Witch of the West</dt><dd> 13</dd><dd> 3hp</dd><dd>£250,000</dd><dd>£35,000</dd><dd> seeker</dd><dd></dd><dd> 1</dd></dl>