3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sections = array( array( 'name' => 'home', 'uri' => '/', 'title' => 'home'), array( 'name' => 'tech', 'uri' => '/tech', 'title' => 'ux/ui' ), array( 'name' => 'monetization', 'uri' => '/monetization', 'title' => 'monetization' ), array( 'name' => 'contact', 'uri' => '/contact', 'title' => 'contact', 'callToAction' => true, 'desktopTitle' => 'contact us' ), array( 'name' => 'blog', 'uri' => 'https://blog.marfeel.com/blog', 'title' => 'blog', 'external' => true), ); function callToActions($section) { return $section["callToAction"]; } function defaultSections($section) { return !$section["callToAction"]; } print_r(array_filter($sections, callToActions)); print_r(array_filter($sections, defaultSections));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Undefined constant "callToActions" in /in/dh3JT:20 Stack trace: #0 {main} thrown in /in/dh3JT on line 20
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: Use of undefined constant callToActions - assumed 'callToActions' (this will throw an Error in a future version of PHP) in /in/dh3JT on line 20 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Array ( [3] => Array ( [name] => contact [uri] => /contact [title] => contact [callToAction] => 1 [desktopTitle] => contact us ) ) Warning: Use of undefined constant defaultSections - assumed 'defaultSections' (this will throw an Error in a future version of PHP) in /in/dh3JT on line 21 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Array ( [0] => Array ( [name] => home [uri] => / [title] => home ) [1] => Array ( [name] => tech [uri] => /tech [title] => ux/ui ) [2] => Array ( [name] => monetization [uri] => /monetization [title] => monetization ) [4] => Array ( [name] => blog [uri] => https://blog.marfeel.com/blog [title] => blog [external] => 1 ) )
Output for 7.3.32 - 7.3.33
Warning: Use of undefined constant callToActions - assumed 'callToActions' (this will throw an Error in a future version of PHP) in /in/dh3JT on line 20 Array ( [3] => Array ( [name] => contact [uri] => /contact [title] => contact [callToAction] => 1 [desktopTitle] => contact us ) ) Warning: Use of undefined constant defaultSections - assumed 'defaultSections' (this will throw an Error in a future version of PHP) in /in/dh3JT on line 21 Array ( [0] => Array ( [name] => home [uri] => / [title] => home ) [1] => Array ( [name] => tech [uri] => /tech [title] => ux/ui ) [2] => Array ( [name] => monetization [uri] => /monetization [title] => monetization ) [4] => Array ( [name] => blog [uri] => https://blog.marfeel.com/blog [title] => blog [external] => 1 ) )
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Use of undefined constant callToActions - assumed 'callToActions' in /in/dh3JT on line 20 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Notice: Undefined index: callToAction in /in/dh3JT on line 12 Array ( [3] => Array ( [name] => contact [uri] => /contact [title] => contact [callToAction] => 1 [desktopTitle] => contact us ) ) Notice: Use of undefined constant defaultSections - assumed 'defaultSections' in /in/dh3JT on line 21 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Notice: Undefined index: callToAction in /in/dh3JT on line 17 Array ( [0] => Array ( [name] => home [uri] => / [title] => home ) [1] => Array ( [name] => tech [uri] => /tech [title] => ux/ui ) [2] => Array ( [name] => monetization [uri] => /monetization [title] => monetization ) [4] => Array ( [name] => blog [uri] => https://blog.marfeel.com/blog [title] => blog [external] => 1 ) )

preferences:
190.65 ms | 405 KiB | 215 Q