March 2021

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
2829 3031   

Style Credit

Expand Cut Tags

No cut tags
Tuesday, October 27th, 2009 01:36 am

Пользуясь случаем, изучаю PHP по его официальной документации. Сам язык, конечно, фееричен, ибо, как и большинство C-подобных, состоит из заплат чуть более, чем полностью. Однако документация доставляет еще больше:

Advanced C users may be familiar with a different usage of the do-while loop, to allow stopping execution in the middle of code blocks, by encapsulating them with do-while (0), and using the break statement. The following code fragment demonstrates this:

<?php
do {
    if ($i < 5) {
        echo "i is not big enough";
        break;
    }
    $i *= $factor;
    if ($i < $minimum_limit) {
        break;
    }
   echo "i is ok";

    /* process i */

} while (0);
?>

Don't worry if you don't understand this right away or at all. You can code scripts and even powerful scripts without using this 'feature'. Since PHP 5.3.0, it is possible to use goto operator instead of this hack.


Повбывав бы!

Reply

(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting