Posts

Welcome to PHP Variables 101 with me, Stretch the giraffe!

<?php // Welcome to PHP Variables 101 with me, Stretch the giraffe! echo " Hello, fellow coders! Stretch here, reaching out from the savannah to teach you about PHP variables. \n" ; // In PHP, a variable starts with the '$' sign, followed by the name of the variable. // Let's declare a variable to store my favorite food. $ favoriteFood = " acacia leaves " ; // Now, let's use that variable. echo " As a giraffe, my favorite food is " . $ favoriteFood . " . \n" ; // Variables can store different types of data, such as strings, integers, and floats. // Here's an integer variable that represents my height in centimeters. $ heightInCm = 550 ; // And here's a float variable for the average amount of water I drink per day in liters. $ waterPerDay = 10 . 5 ; echo " I'm " . $ heightInCm . " cm tall and drink about " . $ waterPerDay . " liters of water a day. \n" ; // Variabl...