<rant>
- Last night I had this family get together thing with some distant cousins of mine. I had to stay the night over in their house. The whole experience was pretty uninteresting and, expecting as such, I took mi Mac lappy with me to do some work.
Being a freelance programmer, I don't go to bed until about 4 am usually and I wasn't about to make an exception just because I was in somebody else's house so I started using my laptop after everyone went to bed and I suddenly realised that for the first time in quite some time I was without access to the Internet. I stay at friends houses quite routinely but they all have Internet and I'm usually too engrossed in my work (and posting on DevNet
) to actually think about going away properly for any length of time; this is a bane of home working that I will be glad to see the back of.
So being there, in a room all on my own I suddenly realised how much I wanted the Internet. I missed DevNet, MSN, blogs, the PHP manual, randomly being able to search stuff.
I felt a bit like Neo in that scene in the Matrix (the first one not any of that sequel poop) where Neo gets a visitor looking for some kind of mechanise that he has "unplug" some time right before he sees the white rabbit. I shouldn't be freelancing too much longer so this is all going to improve.
So anyway to ease mi withdrawals I started reading a PDF I had saved - "PHP Power Programming" and found some new stuff I didn't know about PHP. I really love it when that happens:
- isset() - can take multiple parameters but only returns true if they are all set
- global keyword is deprecated in favour of $GLOBALS
- PHP does actually have the C shift left and right operators; I had just assumed it didn't because they are pretty useless
- break accepts an optional argument of the amount of nesting levels to break out of. Does anybody do this?
- continue also accepts an optional argument only this is the number of iterations to continue for
Also what do people think about "statement list style" control structure when writing views or templatesPHP Power Programming wrote:In PHP 4, you could use [] (square brackets) to access string offsets. This support still exists in PHP 5, and you are likely to bump into it often. However, you should really use the {} notation because it differentiates string offsets from array offsets and thus, makes your code more readable.
Code: Select all
foreach ($array as $v):
?>
<b>
<!-- lots of HTML goes here -->
<?php echo $v?>
</b>
<?php endforeach;PHP Power Programming wrote:do...while loops are often used as an elegant solution for easily breaking
out of a code block if a certain condition is met. Consider the following example:Code: Select all
do { statement list if ($error) { break; } statement list } while (false);