[ create a new paste ] login | about

Link: http://codepad.org/lztnGflZ    [ raw code | output | fork ]

PHP, pasted on Sep 1:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$custombreak = create_function('$a', 'return ($a == 3);');

$i = 0;
do {

    echo $i . '<br />';
    $i++;
    if($custombreak($i)) break;    //<-- I'd like to break the loop with a custom function.
    // if ($i==3)        //<-- this is not what I'm looking for
    //    break;      

} while ($i < 10);
?>


Output:
1
0<br />1<br />2<br />


Create a new paste based on this one


Comments: