Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Integer Used As Array

An integer is not an array, but it is possible to use the array syntax with it. The values are then always null, and since PHP 7.4, a warning is emitted.

PHP code

<?php

var_dump(123[0]);

var_dump(1234['dsds']);

?>

Before

NULL

After

PHP Warning:  Trying to access array offset on int

Warning: Trying to access array offset on int
NULL

PHP version change

This behavior changed in 7.4.

Error Messages

Extension

© 2023-2026, Damien Seguy - Exakat