3v4l.org

run code in 300+ PHP versions simultaneously
<?php function __( $content ) { return $content; } class WP_Locale { public $weekday; public function __construct() { $this->init(); $this->register_globals(); } public function init() { // The weekdays. $this->weekday[0] = /* translators: Weekday. */ __( 'Sunday' ); $this->weekday[1] = /* translators: Weekday. */ __( 'Monday' ); $this->weekday[2] = /* translators: Weekday. */ __( 'Tuesday' ); $this->weekday[3] = /* translators: Weekday. */ __( 'Wednesday' ); $this->weekday[4] = /* translators: Weekday. */ __( 'Thursday' ); $this->weekday[5] = /* translators: Weekday. */ __( 'Friday' ); $this->weekday[6] = /* translators: Weekday. */ __( 'Saturday' ); } public function register_globals() {} } // Should not throw a notice for: // Notice: Trying to access array offset on value of type null. $wp_locale = new WP_Locale(); var_dump( $wp_locale->weekday );
Output for 7.4.33, 8.1.23 - 8.1.31, 8.2.10 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
array(7) { [0]=> string(6) "Sunday" [1]=> string(6) "Monday" [2]=> string(7) "Tuesday" [3]=> string(9) "Wednesday" [4]=> string(8) "Thursday" [5]=> string(6) "Friday" [6]=> string(8) "Saturday" }

preferences:
73.89 ms | 406 KiB | 5 Q