3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_POST['submit']) && isset($_POST['rid']) && !empty($_POST['rid'])) { $location = 'http://results.vtu.ac.in/vitavi.php'; $userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)'; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $location ); $post_array = array( "rid" => $_POST['rid'], "submit" => "SUBMIT" ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array); $response = curl_exec($ch); //change this to whatever... $extract = array("start" =>'<TD width="513">', "end"=>'<b>REGISTRAR(EVALUATION)</b>'); $start = stripos($response, $extract['start']); $end = stripos($response, $extract['end']); $response = substr($response, $start, $end); echo $response."<br/>"; $start = '<TD width="513">'; $end = '<br>'; $response = strstr($response, $start); $end = stripos($response, $end); $response = substr($response, strlen($start), $end - strlen($start)); echo $response."<br/>"; } ?> <html> <form name="new" method="POST"> <p>Enter the University Seat No: <input type="TEXT" name="rid" size="20" maxlength="50"><br><br><br><br> <input type="SUBMIT" name="submit" value="SUBMIT" align="center"><br></p> </form> </html> foreach($xml->xpath('//product[starts-with(name/text(),"Shirt 12")]') as $product) { echo $product->mathamatics; echo "\n"; echo $product->price; echo "\n"; echo $product->color; echo "\n\n"; }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<html> <form name="new" method="POST"> <p>Enter the University Seat No: <input type="TEXT" name="rid" size="20" maxlength="50"><br><br><br><br> <input type="SUBMIT" name="submit" value="SUBMIT" align="center"><br></p> </form> </html> foreach($xml->xpath('//product[starts-with(name/text(),"Shirt 12")]') as $product) { echo $product->mathamatics; echo "\n"; echo $product->price; echo "\n"; echo $product->color; echo "\n\n"; }

preferences:
280.52 ms | 406 KiB | 341 Q