3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_time_limit(0); error_reporting(E_ALL); ini_set('display_errors', 1); ob_implicit_flush(true); ob_end_flush(); /** CONFIG -------------------------------------------------------------------- */ $run = 1000; // Kolikrát se má provést hlasování? $idStart = 190200; // Id od kterého se začne $idEnd = 192000; // Id u kterého se skončí /** --------------------------------------------------------------------------- */ function dlog($msg, $color = 'black') { print('<span style="color: ' . $color . '">[' . date('H:i:s') . '] - ' . $msg . '</span><br />'); } function goVote($idStart, $idEnd, $r) { $GLOBALS['firstRun'] = false; for ($i = $idStart; $i <= $idEnd; $i++) { $opts = array( 'http' => array( 'method' => 'GET', 'user_agent' => md5(time()) . rand(6713678, 8746316834) . rand(6713678, 8746316834) ) ); $context = stream_context_create($opts); $result = file_get_contents('http://agata.suz.cvut.cz/jidelnicky/rating_process.php?id=' . $i . '&rating=5', 0, $context); if ($result == 'already_voted') { $color = "red"; } elseif (is_numeric($result)) { $color = "green"; } else { $color = "orange"; } dlog('[ID:' . $i . '][RUN: ' . $r . '] - result: ' . $result, $color); } return true; } /** --------------------------------------------------------------------------- */ for ($r = 1; $r <= $run; $r++) { goVote($idStart, $idEnd, $r); }

preferences:
36.78 ms | 402 KiB | 5 Q