3v4l.org

run code in 300+ PHP versions simultaneously
<?php // $array = ['Prinsha', 'Jypsy']; // echo $array[0]; // index is 0 // foreach($model as $key => $data) { // } // $array[1] = 'data'; // $array = ['model' => $model]; // $array = array(); // date('Y-m-d', strtotime("+3 days", $time)); $array = [1, 2, 3, 4]; echo $array[0] . "\n"; $associative = ['a' => 'one', 'apple' => '3v4l', '1337' => 'PHP sucks']; echo $associative['a'] . "\n"; echo $associative['apple'] . "\n"; echo $associative[1337] . "\n"; $numbers = [1,2,3,4]; $numbers[] = 5; echo $number[0] . "\n"; echo $number[4] . "\n"; $favColors = array(); $favColors[] = 'BlanchedAlmond'; $favColors[] = 'CadetBlue'; $favColors[] = 'BurlyWood'; $favColors[] = 'DarkOliveGreen'; $favColors[] = 'HotPink'; $favColors[] = 'Papayawhip'; echo $favColors[0];
Output for 8.3.0 - 8.3.4
1 one 3v4l PHP sucks Warning: Undefined variable $number in /in/T0qQT on line 30 Warning: Trying to access array offset on null in /in/T0qQT on line 30 Warning: Undefined variable $number in /in/T0qQT on line 31 Warning: Trying to access array offset on null in /in/T0qQT on line 31 BlanchedAlmond
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
1 one 3v4l PHP sucks Warning: Undefined variable $number in /in/T0qQT on line 30 Warning: Trying to access array offset on value of type null in /in/T0qQT on line 30 Warning: Undefined variable $number in /in/T0qQT on line 31 Warning: Trying to access array offset on value of type null in /in/T0qQT on line 31 BlanchedAlmond
Output for 7.4.0 - 7.4.33
1 one 3v4l PHP sucks Notice: Undefined variable: number in /in/T0qQT on line 30 Notice: Trying to access array offset on value of type null in /in/T0qQT on line 30 Notice: Undefined variable: number in /in/T0qQT on line 31 Notice: Trying to access array offset on value of type null in /in/T0qQT on line 31 BlanchedAlmond
Output for 7.3.32 - 7.3.33
1 one 3v4l PHP sucks BlanchedAlmond
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31
1 one 3v4l PHP sucks Notice: Undefined variable: number in /in/T0qQT on line 30 Notice: Undefined variable: number in /in/T0qQT on line 31 BlanchedAlmond

preferences:
153.32 ms | 402 KiB | 169 Q