3v4l.org

run code in 300+ PHP versions simultaneously
<?php <style> .n {background-color:#AAF} .p {background-color:#FAA} table {font-family:Courier; font-size:12px;} .gray {color:#AAA;} </style> <table> <?php $plays = 100; $ticket_price = 2; $wins_titles = array('No match', '0 + PB','1','1 + PB','2','2 + PB','3','3 + PB','4','4 + PB','5','Jackpot!'); $wins_payouts = array(0,4,0,4,0,7,7,100,100,50000,1000000,1500000000); $draw = array(); for($d=0; $d<5; $d++){ $n = rand(1,69); while(in_array($n, $draw)){ $n = rand(1,69); } $draw[] = $n; } $draw_pb = rand(1,26); $rules = array("Any numbers 1 - 69"=>false, "Only 32 and higher"=>32, "Only 65-69"=>65); echo '<table cellpadding=20><tr><td colspan="2">'; echo '<b>Numbers drawn:</b> <span class="n">'.implode('</span> <span class="n">', $draw).'</span> <span class="p">'.$draw_pb.'</span>'; echo '</td></tr><tr>'; foreach($rules AS $rule => $lowest_number) { echo '<td>'; echo "<b>{$rule}</b></br>"; $total_wins_value = 0; $wins = array(0,0,0,0,0,0,0,0,0,0,0,0); $min = $lowest_number ? $lowest_number : 1; //$min = false; for ($i=0; $i<$plays; $i++) { $play = array(); for($d=0; $d<5; $d++){ $n = rand($min,69); while(in_array($n, $play)){ $n = rand($min,69); } $play[] = $n; } $play_pb = rand(1, 26); $play_matches = 0; foreach($play AS $num){ if (in_array($num, $draw)) { $play_matches++; echo ' <span class="n">'.($num<10?'&nbsp;':'').$num.'</span>'; } else{ echo ' '.($num<10?'&nbsp;':'').$num; } } $pb_match = $play_pb==$draw_pb; if ($pb_match) { echo ' [<span class="p">'.($play_pb<10?'&nbsp;':'').$play_pb.'</span>] '; } else { echo ' ['.($play_pb<10?'&nbsp;':'').$play_pb.'] '; } $score = $play_matches*2 + ($pb_match?1:0); $wins[$score]++; echo "Score: {$score}<br/>"; } $total_wins_value = 0; ?><hr> <table> <tr><th>Match</th><th>Payout</th><th>Count</th><th>Total Win</th></tr> <?php foreach($wins AS $index=>$count): ?> <tr <?= ($index==0 || $index==2 || $index==4 ? 'class="gray"':'') ?>> <td><?= $wins_titles[$index] ?></td> <td>$<?= number_format($wins_payouts[$index],0) ?></td> <td><?= $count ?></td> <?php $win_value = $wins_payouts[$index]*$count; $total_wins_value += $win_value; ?> <td>$<?= number_format($win_value,0) ?></td> </tr> <?php endforeach; ?> </table> <hr> Tickets: <b><?= number_format($plays,0) ?></b><br/> Spent: <b>$<?= number_format(($spent=$plays*$ticket_price),0) ?></b><br/> Won: <b>$<?= number_format($total_wins_value,0) ?></b><br/> Profit: <b><?= number_format(($total_wins_value-$spent)/$spent*100,2) ?>%</b> <hr/><hr/> <?php echo '</td>'; } echo '</tr></table>';
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '<', expecting end of file in /in/o5FMh on line 3
Process exited with code 255.
Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17
Parse error: syntax error, unexpected '<' in /in/o5FMh on line 3
Process exited with code 255.

preferences:
163.36 ms | 1387 KiB | 28 Q