Why does PHP throw the error “Notification: Undefined offset” here:
<?php $MyVar = array(); echo $MyVar[0]; //Notice: Undefined offset: 0 ?>
But not here:
<?php $MyVar = false; echo $MyVar[0]; //No error ?>
This is ultimately because in your second example $MyVar[0]it is null, which is not an error. You could probably refer to $MyVar[0][1][2][3]and get the same result.
$MyVar[0]
$MyVar[0][1][2][3]
The first example is not the zero missing index in the array, so it warns you.
An undefined offset is provided when there are no values in the array and you are trying to reference an uninitialized index.
() , [0].
1- 3- , undefined.
, , . C-, malloc ( ). , PHP , undefined index [offset]
Source: https://habr.com/ru/post/1678654/More articles:redefineBest way to subtract a vector from a matrix in Julia - julia-langHow Haskell handles parallel computing on a multicore machine / cluster - multithreadingUnique yii2 validator only when the field is not empty - phpI do not understand what is happening with file_exists and scandir - fileImportError: no module named google.cloud - python-2.7Create a common dashboard for multiple properties on one page - google-analyticsCreate SourceMaps for a single js file that includes modules with npm and gulp requirements - requireСделать jQuery ajax POST внутри цикла - javascriptMysql container cannot mount data to nfs folder - dockerAll Articles