00 Votes

undefined array key php

Question by Guest | 2022-07-30 at 18:25


$var = array(2,5);

$cnt = count($var);

for ($i = 0; $i < $cnt; $i++) {

echo $var[$i]."\n";

echo $var[$i+1]."\n";



this code show error.

( ! ) Warning: Undefined array key 2 in C:\xampp\htdocs\CAYTASOURCE\snippets\q.php on line 7

I want to print the current and next value.

00 Votes

Why are you posting this another time when your original question is already answered?!


This double post will be deleted soon.
2022-07-30 at 18:28

ReplyPositive Negative

Related Topics

Delphi: System-Wide HotKey

Tutorial | 1 Comment

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.