PHP

A ternary operator is a quick shortcut to bypass the multi-line if-else statement. It is sufficient when simple setting a value of a variable based on a condition. It looks like this: That is saying “if $variable equals 10 then set $x equal to true, otherwise set $x equal to...

More
  • 2010-06-22

php.net – where I posted this Overview This is something that I used to use on this site before I went to WordPress. If you checked “view source” and looked at the meta keywords, you would notice a comma separated string. When programming, you may want to take a comma...

More
  • 2010-06-22
  • 3

Using objects in PHP doesn’t have to be a one-way-street. PHP objects are very similar to any other server side language in that they can run functions for you, return values, and perform just about any needed task that you can write, but they can also be passed around within...

More
  • 2010-04-16

This one drove me nuts for a while so here is how to work with global scope in PHP classes. From within one function, if you want a variable of any sort to be globally visible, then you must use the keyword global, like this: Now just because you’ve declared...

More
  • 2009-11-06