PHP test – #1

What happens with the following code:

<?php
for($i=a;$i&lt;=z;$i++) echo("$i\n");
?>

And what’s the difference with?

<?php
for($i=a;$i&lt;z;$i++) echo("$i\n");
?>

Why is the result different? and How?

Worst:

<?php
$i=a;
while(strcmp($i,z)<=0){
   echo($i."\n");
   $i++;
}
?>

Gives exactly the same result as the second exemple.

hints:
http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion
http://www.php.net/manual/en/language.operators.comparison.php
http://www.php.net/manual/en/language.types.string.php

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>