3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array( array('iso'=>'A3+', 'height'=>329, 'width'=>483, 'descrip'=>'A3+ (329 x 483 mm)'), array('iso'=>'A3_EXTRA', 'height'=>322, 'width'=>445, 'descrip'=>'A3 EXTRA (322 x 445 mm)'), array('iso'=>'A3_SUPER', 'height'=>305, 'width'=>508, 'descrip'=>'A3 SUPER (305 x 508 mm)'), array('iso'=>'SUPER_A3', 'height'=>305, 'width'=>487, 'descrip'=>'SUPER A3 (305 x 487 mm)'), array('iso'=>'A4_EXTRA', 'height'=>235, 'width'=>322, 'descrip'=>'A4 EXTRA (235 x 322 mm)'), array('iso'=>'A4_SUPER', 'height'=>229, 'width'=>322, 'descrip'=>'A4 SUPER (229 x 322 mm)'), array('iso'=>'SUPER_A4', 'height'=>227, 'width'=>356, 'descrip'=>'SUPER A4 (227 x 356 mm)'), array('iso'=>'A4_LONG', 'height'=>210, 'width'=>348, 'descrip'=>'A4 LONG (210 x 348 mm)'), array('iso'=>'F4', 'height'=>210, 'width'=>330, 'descrip'=>'F4 (210 x 330 mm)'), array('iso'=>'SO_B5_EXTRA', 'height'=>202, 'width'=>276, 'descrip'=>'SO B5 EXTRA (202 x 276 mm)'), array('iso'=>'A5_EXTRA', 'height'=>173, 'width'=>235, 'descrip'=>'A5 EXTRA (173 x 235 mm)'), array('iso'=>'ANSI_E', 'height'=>863.6, 'width'=>1117.6, 'descrip'=>'ANSI E (863.6 x 1117.6 mm)'), array('iso'=>'ANSI_D', 'height'=>558.8, 'width'=>863.6, 'descrip'=>'ANSI D (558.8 x 863.6 mm)'), array('iso'=>'ANSI_C', 'height'=>431.8, 'width'=>558.8, 'descrip'=>'ANSI C (431.8 x 558.8 mm)'), array('iso'=>'ANSI_B', 'height'=>279.4, 'width'=>431.8, 'descrip'=>'ANSI B (279.4 x 431.8 mm)'), array('iso'=>'ANSI_A', 'height'=>215.9, 'width'=>279.4, 'descrip'=>'ANSI A (215.9 x 279.4 mm)'), ); $filter = "A4"; $filt = array_filter($arr, function($e) { strcasecmp(substr($e['iso'], 0, strlen($filter)), $filter) === 0; }); var_dump($filt);
based on KP0Na
Output for 5.3.0 - 7.2.0
Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 Notice: Undefined variable: filter in /in/5iSR2 on line 22 array(0) { }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/5iSR2 on line 22
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/5iSR2 on line 22
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/5iSR2 on line 22
Process exited with code 255.