RE: [PHP] when logic fails, PHP randomly skips execution of lines
| From: | php | Date: | Tue, 18 Sep 2001 16:51:38 +0000 |
| Subject: | RE: [PHP] when logic fails, PHP randomly skips execution of lines | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67724@lists.php.net to get a copy of this message | ||
How about:
$enc="abcdefe";
echo "swap: ".$enc."\n";
// swap 1st and 2nd half of string
$len= (int)strlen($enc)/2;
$enc=substr($enc,$len).substr($enc,0,$len);
echo "swp2: ".$enc."\n";
echo "end\n";
Your /2 system wont' work when strlen is an odd number.
Sean
-----Original Message-----
From: Jens Kisters [mailto:j.kisters@rosomm-partner.de]
Sent: Wednesday, 19 September 2001 2:43 AM
To: php-general@lists.php.net
Subject: [PHP] when logic fails, PHP randomly skips execution of lines
Hello everbody,
I have noticed something quite strange,
i have a piece of code that looks like, i removed some of it to make it
readable:
there are no statements in the code that would cause the termination of the
method before reaching the last line, no return, die or whatever.
<?
echo "\nBegin\n";
/* some code that builds a string of a few hundred bytes*/
/* a loop that ads ads numbers to the ascii vals of those string named $enc
*/
/* a loop that swaps all the neighboring chars in the string */
echo "swap: ".$enc."\n";
// swap 1st and 2nd half of string
$len=strlen($enc);
$enc=substr($enc,$len/2,$len/2).substr($enc,0,$len/2);
echo "swp2: ".$enc."\n";
echo "end\n";
?>