3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = new Data(); class Data { function __construct(){ if(!isset($_SESSION['id'])){ header('location:../../'); } } function getSubject($search){ global $con; $q = "select * from subject where code like '%$search%' or title like '%$search%' order by code asc"; $r = mysqli_query($con, $q) or die(mysqli_error($con)); return $subjects = mysqli_fetch_all($r,MYSQLI_ASSOC); } } <?php include "data/data_model.php"; $search = isset($_POST["search"]); $subject = $data->getSubject($search); ?> <form action="subject.php" method="post"> <label> <input type="text" class="form-control" name="search" placeholder="Search Subject..." > </label> <button type="submit" name="search" class="btn btn-success" value="search"><i class="fa fa-search"></i> Search</button> </form>
Output for 8.3.5
Parse error: syntax error, unexpected token "<", expecting end of file in /in/rfAiq on line 21
Process exited with code 255.
Output for 7.1.25 - 7.1.30, 7.2.0 - 7.2.20, 7.3.0 - 7.3.7
Parse error: syntax error, unexpected '<', expecting end of file in /in/rfAiq on line 21
Process exited with code 255.

preferences:
44.2 ms | 636 KiB | 3 Q