Category Archive: PHP

PHP: Use from Windows command line

In today‚Äôs post I will show you how you can use the PHP scripting language on a Windows machine without requiring any installation. There are a number of advantages to this. As a first bonus, you can use existing skills you have to do certain tasks on your windows machine. Additionally, because no installation of …

Continue reading »

PHP: Switch structure to check variable

Suppose you want to use PHP check the variable $var and see if it smaller than, equal to or larger than zero. There are two ways to go about this: switch($var) { case 0: echo “Equal to zero”; break; case ($var0): echo “Larger than zero!”; break; } The issue with this code is that if …

Continue reading »

PHP: Get last iteration in a for..each loop

Find out how to check if you are currently in the first or last iteration of your foreach loop in PHP.