Posts Tagged ‘PHP’

PHP’s Very Useful “HEREDOC” Syntax

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

Read more ...

PHP’s Identity Comparison To The Rescue

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.

Read more ...

Sorting Multi-dimensional Arrays in PHP

Most programming languages have some sort (pun intendedWinking smile) 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!

Read more ...

Display WordPress Shortcode without Executing It

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.

Read more ...

PHP Quotable Quotes: Single Or Double – What’s The Difference?

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.

Read more ...