3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = file_get_contents($jsonfile); $games = json_decode($data, true); $gamesnum = count($games['data']['games']['game']); $gamesnum = $gamesnum-1; $home_team = ''; $away_team = ''; for ($i=$gamesnum;$i>=0;$i--) { $home_name_abbrev[$i]= $games['data']['games']['game'][$i]['home_name_abbrev']; $hometeam[$i]= $games['data']['games']['game'][$i]['home_team_name']; $away_name_abbrev[$i]= $games['data']['games']['game'][$i]['away_name_abbrev']; $awayteam[$i]= $games['data']['games']['game'][$i]['away_team_name']; $status[$i] = $games['data']['games']['game'][$i]['status']; $etime[$i] = $games['data']['games']['game'][$i]['first_pitch_et']; $time = strtotime($etime[$i]); $startTime = date("h:i", strtotime('-30 minutes', $time)); $ampm[$i] = $games['data']['games']['game'][$i]['ampm']; $league[$i] = $games['data']['games']['game'][$i]['league']; }
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $jsonfile in /in/MBOOJ on line 3 Deprecated: file_get_contents(): Passing null to parameter #1 ($filename) of type string is deprecated in /in/MBOOJ on line 3 Fatal error: Uncaught ValueError: Path cannot be empty in /in/MBOOJ:3 Stack trace: #0 /in/MBOOJ(3): file_get_contents('') #1 {main} thrown in /in/MBOOJ on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $jsonfile in /in/MBOOJ on line 3 Fatal error: Uncaught ValueError: Path cannot be empty in /in/MBOOJ:3 Stack trace: #0 /in/MBOOJ(3): file_get_contents('') #1 {main} thrown in /in/MBOOJ on line 3
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Notice: Undefined variable: jsonfile in /in/MBOOJ on line 3 Warning: file_get_contents(): Filename cannot be empty in /in/MBOOJ on line 3 Notice: Trying to access array offset on value of type null in /in/MBOOJ on line 5 Notice: Trying to access array offset on value of type null in /in/MBOOJ on line 5 Notice: Trying to access array offset on value of type null in /in/MBOOJ on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/MBOOJ on line 5
Output for 7.3.32 - 7.3.33
Warning: file_get_contents(): Filename cannot be empty in /in/MBOOJ on line 3 Warning: count(): Parameter must be an array or an object that implements Countable in /in/MBOOJ on line 5
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
Notice: Undefined variable: jsonfile in /in/MBOOJ on line 3 Warning: file_get_contents(): Filename cannot be empty in /in/MBOOJ on line 3 Warning: count(): Parameter must be an array or an object that implements Countable in /in/MBOOJ on line 5
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Undefined variable: jsonfile in /in/MBOOJ on line 3 Warning: file_get_contents(): Filename cannot be empty in /in/MBOOJ on line 3

preferences:
193.63 ms | 402 KiB | 295 Q