PHP CLI One Liners

A series of PHP one liners that run on the command line. You can use Windows (WSL) Mac or Linux.

Each example must be performed on a single line of code and ran in the terminal.

Your code will be reviewed on Twitch Feb 14th (Sunday)

Level 1 - RSS Feed

Return the HTCW podcast feed as XML The RSS feed: https://anchor.fm/s/2d0cded8/podcast/rss

Level 2 - Randomise the alphabet

Return the alphabet in a random sequence

Level 3 - Count names in an array

Return an array that shows a count for each occurrence of these names.

$names = ['Pete', 'Kim', 'Jim', 'Pete', 'Kate', 'Billy','Billy','Kim','Kim'];

Level 4 - Display the Happy Birthday song

Return the following song:

Happy Birthday to You
Happy Birthday to You
Happy Birthday dear $YOUR_NAME
Happy Birthday to You

Replace $YOUR_NAME with your name or Twitch/Discord username Each line in the song should be a output as a line in the terminal

Level 5 - Output the contents of the current working directory

Use php to access the shell and list the contents of the current working directory

Video Review

Review coming soon