Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show duplicated key warning in PHP array definition

Tags:

php

Is it possible to get a warning in the following code?

error_reporting(E_ALL);

  $s = array(
      'a' => '1',
      'a' => '1'
   );

var_export( $s );
like image 545
Ryan Avatar asked Mar 24 '26 17:03

Ryan


1 Answers

Your only hope (apart from count-ing yourself) is that your editor is smart enough to highlight the typo. This screenshot is from PHPStorm:

enter image description here

like image 148
Álvaro González Avatar answered Mar 27 '26 07:03

Álvaro González



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!