Strings can be stored three different ways in PHP. I talked about two of them in a previous post. Now I’ll discuss the most powerful, yet underused, of the bunch.
Ordinarily I use single quotes when storing strings in PHP. But sometimes I have to use double-quotes as the two methods of quoting have tradeoffs. A third possibility, known as
Here’s a PHP gotcha that stumped me for awhile not too long ago. It reminded me to pay attention to how comparisons are actually made.
Most programming languages have some sort (pun intended) of sort functionality built-in for sorting the elements of an array. But what if you need to sort multiple pieces of related data? A multi-dimensional array? PHP’s
array_multisort to the rescue!
Shortcodes are a powerful feature of WordPress. Used in many plugins, they are written as square bracket-delimited strings. But if you’re trying to document the usage of a shortcode in a post, without actually having it executed, you might have a little problem.
Strings, strings and more strings. What would programming be without them? It seems every language treats them just a little bit differently. At least enough so to cause confusion for a first-timer. PHP uses two primary (not the only) methods to write strings. I’ll discuss bookending strings in PHP today.