3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [ [ 'slug' => 'products-services-pricing', 'text' => 'Products/Services and Pricing', ], [ 'slug' => 'promotions-plan', 'text' => 'Promotions Plan', ], ...(1 == 1) ? [ ['slug' => 'distribution-plan', 'text' => 'Distribution Plan'] ] : [], ]; var_export($arr); echo "\n---\n"; $arr = [ [ 'slug' => 'products-services-pricing', 'text' => 'Products/Services and Pricing', ], [ 'slug' => 'promotions-plan', 'text' => 'Promotions Plan', ], ...(1 == 2) ? [ ['slug' => 'distribution-plan', 'text' => 'Distribution Plan'] ] : [], ]; var_export($arr);
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.21, 8.5.0 - 8.5.7
array ( 0 => array ( 'slug' => 'products-services-pricing', 'text' => 'Products/Services and Pricing', ), 1 => array ( 'slug' => 'promotions-plan', 'text' => 'Promotions Plan', ), 2 => array ( 'slug' => 'distribution-plan', 'text' => 'Distribution Plan', ), ) --- array ( 0 => array ( 'slug' => 'products-services-pricing', 'text' => 'Products/Services and Pricing', ), 1 => array ( 'slug' => 'promotions-plan', 'text' => 'Promotions Plan', ), )

preferences:
106.01 ms | 1361 KiB | 4 Q