Sorry to ask, it's only for my understanding !
I just start learning php.
I added some values from different method to an array and
it come to a strange problem that i can't find an answer on the web.
(sorry if it's stupid, i just want to know why it do that.)
My PHP/HTML code:
<?php
$test[] = 1;
$test += array('2','3','4');
$test += array('4in4',5 => '5');
$test[] = 6;
$test[] += 7;
?>
<!doctype html>
<html lang="fr-CA" >
<head>
<meta charset="UTF-8">
<body>
<?php echo '<h1>Test de Tableau</h1>','<br>',
'$test[0] = ',$test[0],'<br>',
'$test[1] = ',$test[1],'<br>',
'$test[2] = ',$test[2],'<br>',
'$test[3] = ',$test[3],'<br>',
'$test[4] = ',$test[4],'<br>',
'$test[5] = ',$test[5],'<br>',
'$test[6] = ',$test[6],'<br>',
'$test[7] = ',$test[7],'<br>',
'<h4>count = ',count($test),'/8</h4>'; ?>
</body>
And here is the result :
Test de Tableau
$test[0] = 1
$test[1] = 3
$test[2] = 4
$test[3] =
Notice: Undefined offset: 3 in /opt/lampp/htdocs/mhx/test/index.php on line 26
$test[4] =
Notice: Undefined offset: 4 in /opt/lampp/htdocs/mhx/test/index.php on line 27
$test[5] = 5
$test[6] = 6
$test[7] = 7
count = 6/8
Thanks to answer !
MHX