troubleshooting Question

Passing PHP For loop counter in array

Avatar of nainil
nainilFlag for United States of America asked on
PHP
5 Comments1 Solution300 ViewsLast Modified:
I am using a for loop to parse through an array. One segment in the array is numeric (in sync with the counter). I have the following code in place. But, I get an error: Notice:  Undefined offset: 24 in E:\wamp\www\index.php on line X.

This is the line in the code which the error is referring:
      if($myarr['result']['record'][$i]['name'] == $domain)
$linecount = count($myarr['result']['record']);

$linenumber=0;

for($i=0;$i<=$linecount;$i++)
{
	if($myarr['result']['record'][$i]['name'] == $domain)
	{
		if($myarr['result']['record'][$i]['type'] == 'A')
		{
			$linenumber = $myarr['result']['record'][$i]['Line'];
			exit;
		}
	}
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros