monkinetic the blog

Daily Digest for Sunday, Oct 13, 2002

☀️ Earliest posts come first.

Multi-level 'break'

Miscellaneous h4xx0r note: PHP has a mutli-level break which I had not seen before in a language. Used normally, break will exit the current loop (while, for, etc). Using the optional integer argument:

break n will break you out of as many nested loops as specified. For example:

 10 /* Using the optional argument. */
 11 $i = 0;
 12 while ( ++$i ) {
 13     switch ( $i ) {
 14     case 5:
 15         echo "At 5
"; 16 break 1; /* Exit only the switch. */ 17 case 10: 18 echo "At 10; quitting
\n"; 19 break 2; /* Exit the switch and the while. */ 20 default: 21 break; 22 } 23 }

Found here.

Steve Ivy

Although I got the web application book for PHP, I‘m starting with the online PHP Manual. It’s probably the best step-by-step guide to a new language I‘ve ever seen.

This is also confirming my long-held belief that languages are easy. APIs are hard. PHP is basically a tame perl. Nooooo problem. I bet it’s going to take me a while though to get into the flow with the PHP APIs for things like database manipulation, networking, etc. That‘s where the book I picked up will help.

~ # 00:00 ~