NOTES: 2021-04-26 | Thoughts on PHP and Life

I have all these PHP snippets on my desk of things I learned taking Linkedin Learning PHP courses. I took a 4-hr long coding test for a remote PHP/LAMP Developer job with the Huntsville, AL branch of NASA. I was excited for the opportunity, but learning I was lacking on all kinds of modern programming techniques, including the ubiquitous arrow functionwhich was present in both PHP and JavaScript ES8.

That was in February. But, aside from the new concepts, I discovered I was also greatly in need of a refresher in the whole workflow of LAMP web development. Things I used to know and work with daily at (2011) were now foreign and distant to me.

With a little refresher course in fundamentals and a lot of practice I knew it would all come back to me. And it did. I was writing basic PHP single-file programs in no time!

The Code

The following are notes on different PHP functions, syntax, variables, and techniques that were important enough for me to write down. I’m aggregating them here to get them off my desk, help me remember them by having them all in one easily findable place (the internet), and also, hopefully, to help you on your journey to learning PHP and LAMP development concepts.

Leave a comment if you have a question and I’ll do my best to reply quickly!


$dir = new DirectoryIterator('common');

foreach ($dir as $file) {
   echo $file . '<br>";


// SPLFileInfo()

getSize() - File size in bytes
getATime() - Last accessed time (unix timestamp)
getMTime() - Last modified
getType() - File, symlink, or dir


is_file() function VS isFile() class method


// Basic PHP 7 project folder structure



mysqli_connect (
   $host, $user, $password, $database



Callback_Filter() // requires PHP 5.3 or greater


$courses = simpleXML_load_file('/path/courses.xml');

// $courses = new SimpleXMLIterator;?

foreach ($courses as $course) {
   $matches = new RegexIterator(
      $course->author, '/joh?n peck/i');

   foreach ($matches as $match) {
      echo $course->title . ' with ' . $match . '(Durations: '
         . $course->duration . ')<br>';


if (isset ($_POST['download'])) {
   $titles = array_keys ($rates[0]);
   $file = new SplTempFileObject();
   $foreach ($rates as $currency) {



That’s good for now.
Have a great day and God bless!

Date Published: 04/26/21

Date Published: 2021-04-26
Date Updated: 2022-09-06

Eric Hepperle

Eric loves to write code, play guitar, and help businesses solve challenges with code and design.
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x