http://code.suck-o.com/42381" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;
What is wrong in this code pls??
Whats wrong with this code?
- Broken Angel
- Fame ! Where are the chicks?!
- Posts: 432
- Joined: 05 Jul 2010, 04:58
- 13
- Contact:
Whats wrong with this code?
God Blessed Me With Forgiveness And I Forgive You With My Revenge...!
-Broken Angel
-Broken Angel
Re: Whats wrong with this code?
You are incrementing the $i variable outside of the loop, thus $i will always be less than $n, so the loop will go on forever.
"The best place to hide a tree, is in a forest"
- Broken Angel
- Fame ! Where are the chicks?!
- Posts: 432
- Joined: 05 Jul 2010, 04:58
- 13
- Contact:
Re: Whats wrong with this code?
Ok i just put the
++$i inside the { } in the end as in like this
but the output comes with this error:
and now this goes on for ever
++$i inside the { } in the end as in like this
Code: Select all
{echo....
++$i
}
but the output comes with this error:
I
don't
know
how
this
works
but
we
will
still
do
it.
Notice: Undefined offset: 12 in C:\xampp\htdocs\simple_blog_1\while_do_practicla.php on line 10
Notice: Undefined offset: 13 in C:\xampp\htdocs\simple_blog_1\while_do_practicla.php on line 10
Notice: Undefined offset: 14 in C:\xampp\htdocs\simple_blog_1\while_do_practicla.php on line 10
and now this goes on for ever
God Blessed Me With Forgiveness And I Forgive You With My Revenge...!
-Broken Angel
-Broken Angel
Re: Whats wrong with this code?
This works without any issues
Code: Select all
<?php
$foo=array("I","don't","know","how","this","works","but","we","will","still","do","it.");
$i=0;
$n=count($foo); //This stroes the number of values in the array
while ($i<$n){
echo $foo[$i],"<br />";
++$i;
}
?>
"The best place to hide a tree, is in a forest"