Here are the similarities and differences I noticed when switching from the mysql_ prefixed functions to the mysqli_ functions in PHP. Creating a Connection Creating and closing a connection are exactly the same using mysqli_: // Creating a Connection with mysql_connect() $conn = mysql_connect($servername, $username, $password); // Do stuff with […]
Tag: PHP Function
Increment Hex Values in PHP
Hex values aren’t just for colors! I recently had to generate a list of values from 00-ff and came up with this little snippet. Here’s how to increment hex values in PHP: For Reference: Hex Values Use (line 8) 0-f $x < 16 00-ff $x < 256 000-fff $x < […]
Using date() and strtotime() to Set a Delivery or Shipping Date
Scenario: Let’s say your business ships products out every Monday, but the cut off date for ordering for the next delivery date is Thursday. This snippet checks the day of the week with date(‘w’). (It can also be accomplished by using l, D, or N.) Then, if it’s past a […]
PHP Function money_format()
I hope everyone had a great Thanksgiving! 🙂 I was inspired for this week’s Function Friday when I was working with Stripe API (using PHP). I was developing a webhook for when a charge fails that would send an email to various departments at my company. We needed the email […]
PHP Function str_replace()
Welcome to the inaugural Function Friday post! I created Function Friday as a way to both share my PHP and WordPress knowledge with others, and force myself to continue to learn on a schedule. After graduating with my Bachelors of Science in Technology degree in 2014, I realized I crave […]