Guy writing code

My prefered tools for coding

Back in 2011, I wrote few short posts about what I install right after reinstalling windows.  I figured that 9 years is enough time between these kinds of posts.  This time, I’m going to go over my prefered tools for writing code.

Continue reading "My prefered tools for coding"

PHP function of the day: array_rand()

For day 20 of 21 in the “PHP Function of the day” series, I’m going to look at array_rand().  The function takes a required array and an optional number of random keys to return.  It returns a random key (not the value). Let’s take a look. <?php $names = array(“Joe”,”Jim”,”Sarah”,”Jill”); $numbers = array(1,2,3,4,5,6,7,8,9); $names_rand_keys = array_rand($names,3); $numbers_rand_keys …

Continue reading "PHP function of the day: array_rand()"

PHP function of the day: date_diff()

For day 19 of 21 in the “PHP Function of the day” series, I’m going to look at date_diff(). Let’s take a look. <?php $shoppingDay=date_create(“2020-05-28”); $payDay=date_create(“2020-06-01”); $difference = date_diff($shoppingDay,$payDay); print_r($difference); echo “<br /><br />”.$difference->format(“%R%a days”); ?>   See the output   As you an see, this calculates the difference between two dates (something that could be pretty …

Continue reading "PHP function of the day: date_diff()"

PHP function of the day: printf()

For day 16 of 21 in the “PHP Function of the day” series, I’m going to look at printf(). This one is pretty interesting.  It allows you to define a format and a series of arguments.  The “%[something]” in the format string is used to define both where the argument’s value is output and the expected format.  …

Continue reading "PHP function of the day: printf()"

PHP function of the day: array_flip()

For day 15 of 21 in the “PHP Function of the day” series, I’m going to look at array_flip(). As you might guess, this function “flips” the array so that the key is the value and the value is the key. Let’s take a look. <?php $joe = array(“fname”=>”Joe”,”lname”=>”Steinbring”,”website”=>”jws.dev”); print_r($joe); echo(“<br />”); print_r(array_flip($joe)); echo(“<br /><br />”); $foods …

Continue reading "PHP function of the day: array_flip()"

PHP function of the day: date()

For day 14 of 21 in the “PHP Function of the day” series, I’m going to look at date(). The function takes a required format and an optional timestamp and outputs a formatted date. Let’s take a look. <?php echo “This is the “.date(“d”).”th day of the month.”.”<br />”; echo “This is the “.date(“m”).”th month of the …

Continue reading "PHP function of the day: date()"