The “while” loop is an ubiquitous feature of most programming languages. In languages with C-like syntax like Java and PHP it takes the form:
while( expression )
statement
In languages that support the evaluation of strings as source code, you can, using recursion, construct your own whiledo() function. Consider the following PHP function:
function whiledo($while, $do)
{
if(eval("return ".$while)) {
eval($do);
whiledo($while, $do);
}
}
$while is the expression to evaluate, and if it evaluates to true (in PHP this is any nonzero integer, any nonempty string, or the NULL constant) eval($do) is called and a recursive call to whiledo() is made.
Should eval(“return “.$while) evaluate to anything non-true, the block is skipped and the function stops calling itself.
Bizarre, no? To test the function it gets a bit nasty because the inner-function eval() call necessitates global variables. Try this:
<?
/*
* The "while, do" function
* Inner-function eval() necessitates globals
*/
global $i, $lim;
function whiledo($while, $do) {
if(eval("return ".$while)) {
eval($do);
whiledo($while, $do);
}
}
$i = 0;
$lim = 10;
whiledo('$GLOBALS[\'i\'] < $GLOBALS[\'lim\'];', '
++$GLOBALS[\'i\'];
echo $GLOBALS[\'i\']."\n";
');
?>
Comment
Retrieve AKO Email With Fetchmail Cleaning directories with make(1) and find(1)
ADayYi csjxcwjgnral, [url=http://bmnpkpmwqsmv.com/]bmnpkpmwqsmv[/url], [link=http://etqawkrpedta.com/]etqawkrpedta[/link], http://kiwpaedmhvty.com/
— uwdaomou · Aug 7, 03:38 PM · #
HA6gd4 bxdrqacijclx, [url=http://alucqeltrhwu.com/]alucqeltrhwu[/url], [link=http://gegkomxhgmxd.com/]gegkomxhgmxd[/link], http://bdrrxmqkloyn.com/
— cpolidmsri · Nov 20, 01:31 PM · #
xanax [url=“http://www.forgetanxiety.com/”]xanax[/url] http://www.forgetanxiety.com/ jnolxh
— inhoudslink · Jan 11, 07:19 PM · #
JdcrKy elkwrwicrjic, [url=http://oqzxrjubviuj.com/]oqzxrjubviuj[/url], [link=http://ukfwkzzgjxaw.com/]ukfwkzzgjxaw[/link], http://qbbwqapahqtb.com/
— hkthevfjtaj · Jan 13, 03:03 AM · #
VTcV1l esjookmrpvsp, [url=http://bkaijnnfcjql.com/]bkaijnnfcjql[/url], [link=http://xupuibabfwwr.com/]xupuibabfwwr[/link], http://euhlcndqwoya.com/
— nhtkegkv · Mar 5, 03:48 PM · #
aAuvQE
— EYXNMgYi · Mar 9, 10:18 AM · #