2015 was my year to really dive into PHP. Up until this year, PHP was hobby language for me -- much as Python, Haskell, C++, Dart, JavaScript, and Java have been hobby languages. Granted, last year I finally took a job where PHP is where I spend half of my time. This year, I took up intensive study of PHP.…
The "switch" statement within various languages, contains a similar structure. This makes the PHP switch statement familiar. A failing example of PHP's switch statement was brought up yesterday at work. Someone asked why the expected responses to this were not received. php <?php $convertQ = function ($str) { switch ($str) { case 0: return 'no'; case 'No': return 'no'; case…
Introduction I have been thinking about numbers for most of my life. It wasn't until I helped my oldest child learn to count to 20 that I thought that the way we count in the English language is silly. There is no logic in our base-10 counting system until we get to 17: "fif teen" (what's a "fif?") is followed…
I attended Lone Star PHP last year with much hope and even more trepidation as to my abilities to hold my own with other members of the PHP community. I was the recipient of the Lone Star PHP scholarship, so my attendance and stay were taken care of by the conference sponsors (thank you! thank you! thank you!). I spent…
The first day of Lone Star 2015 was devoted to training. The workshop track I took was geared towards unit testing. Getting Started with PHPUnit - Matt Frost - Twitter: @shrtwhitebldguy - Slides One reason I took this workshop was so that I could become more familiar with mocks. I had a mental block when it comes to mocks and…
Heredoc Heredoc will define a string of text in a what-you-see-is-what-you-mean type of format. So, if you want to echo out structured text, like so: text I think that I Shall never pay As much as I Have for 2015-04-23 You would put it in a heredoc like this: php $today = date('Y-m-d'); $poem = <<<HTML I think that I…
In PHP, we have two ways of formatting an echo statement: we can choose to use single-quotes or double-quotes. The choice is less dependent upon which side of the Atlantic we learned to read and more dependent upon what we hope to accomplish with echoing that string. If you want to echo the string without parsing it, use single-quotes. If…
We hired a new guy at work. I was officially the new guy for 2 months, now we have someone new. I was given the task to get him up and running since the experience was still fresh for me. Once he got his dev environment going, he would look over my shoulder to watch what I was doing. At…