Andy-H Posted January 14, 2010 Share Posted January 14, 2010 Say if I had a script using if/else blocks like so: $myVar = true; if ( $myVar ) { //Obviously this code executes. } else { // Does PHP waste time processing the code here or can it jump the block if a statement evaluates to //false? } // I.E does it jump to this brace, without reading, processing, parsing w.e the contained code. Thanks for any help here. Quote Link to comment https://forums.phpfreaks.com/topic/188401-something-i-always-wondered/ Share on other sites More sharing options...
oni-kun Posted January 14, 2010 Share Posted January 14, 2010 It of course has to parse the code to find the ending brace, It does not /run/ it but it does debug it. $myVar = true; if (isset($myVar)) { echo "I exist?"; } else { !@^&*What am I?^%$an error?&&&^&*^ } Why not try that code? Quote Link to comment https://forums.phpfreaks.com/topic/188401-something-i-always-wondered/#findComment-994597 Share on other sites More sharing options...
Andy-H Posted January 14, 2010 Author Share Posted January 14, 2010 Oh yeh, duhhhh lol =P Quote Link to comment https://forums.phpfreaks.com/topic/188401-something-i-always-wondered/#findComment-994598 Share on other sites More sharing options...
ignace Posted January 14, 2010 Share Posted January 14, 2010 You could take up Assembler it will give you a good idea how a programming language works and an if/else for that matter. Your if and else are basically two blocks if the if fails (based on internal flags) it jumps to the else block otherwise it jumps to the if block. The good old' days Quote Link to comment https://forums.phpfreaks.com/topic/188401-something-i-always-wondered/#findComment-994820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.