Integers. You mean math? The integer data type represents whole numbers, either positive or negative or zero, not fractions. Before we get into anything worth looking at, let’s look at a simple example. Create a new PHP file and copy the following code into it. <?php $x = 0; $y = 1; $z = -2; echo $x + $y + $z; ?> You should get a -1 as the result. I know that we haven’t looked at arithmetic operators, but I’m sure that you can figure out what the + operator does in the previous example. We set
Articles
I frequently hear that there aren’t enough hours in the day to accomplish everything that I do on a daily basis. I love those. It’s all about organization. It’s so much about organization that I spend roughly 30 minutes each day thinking about how to improve my already organized life. It doesn’t take much, but with small increments, it adds up. Start with Jira You may think that Jira, or any other project management tool, should be used only at work. I’m here to tell you that you can project manage anything that you’d like, including your life. If this
What Do You Mean Truthy? We looked at boolean values in the previous article. Booleans represent true or false. PHP Truthy Booleans, which are values that are not true or false, but when evaluated inside an expression, they can act like they are. The best examples are the integers 0 and 1. If we passed 1 to the if statement, PHP would interpret the number 1 as truthy and would execute the statement inside the body. If you pass 0 to the if statement, PHP would interpret 0 as falsy, so it would not execute the statement inside the if
True or False? The PHP boolean value is a scalar data type that represents the values true and false. That’s really it. End of article. That would be a short article so lets take a look at a few examples before we abruptly end it. Create a new file and name it booleans_intro.php. We’ll be testing out the code below with our booleans_intro.php file. One of my favorite vehicles, and this is important for understanding booleans properly, is the MKIV 2JZGTE Toyota Supra. We’ll create a variable to check whether that Supra currently exists in my garage or not.
Can you even store data? The best way to introduce PHP variables is to start thinking about math. You might remember that there are these things called x and y variables that used to store numbers. If x = 2 and y = 5 then what is x + y? Just substitute 2 for x and 5 for y and you get 7. Variables are just storage containers. You can store any data type that you would like inside of them; we’ll look at strings and integers below. In PHP, variables start with a dollar sign, followed by either the
Economic downturns have so far been my most profitable times. While everyone else is panicking, I get to work. Sometimes they’re career moves and other times they’re purely financial; most of the time they’re both. We’re in another pivotal time. How will you take advantage of the situation? What Most People Do There’s a saying that you’ve probably heard, “if it bleeds it leads.” This is the time that news organizations get excited about. They love the turmoil since people will be glued to their news station of choice. The market will continue to swing wildly and we’ll most likely
Why so many edge cases? Edge cases. You have to love them. It’s what will destroy your company and your employee’s morale. Chasing edge-cases can be a developers biggest pitfall if done in the wrong environment or their greatest strength if done in the right environment. How do you draw the balance and when? That’s what we’ll tackle in this article. If you haven’t read my article on MVP software development, I encourage you to do so. It covers thinking in MVP terms, which we’ll cover throughout this article. What is an Edge Case? The best way that I can
Stop Living Life Like There’s a Deadline. It’s no lie that by the time you’re 35, you want nothing to do with writing code professionally. When I was in my early 20s, I thought that I would write code forever. Nothing seems more appealing than spending 8–12 hours each day writing code or learning about development. Those were exciting times; I’m sure you’re going through the same thing, or you’ve been through it already. If you do it for long enough, you will burn out and that’s when it starts going down hill. Signs That You’re Overdoing It Sleeping Less.
Your first Algorithm ;( The Bubble Sort algorithm sorts an array of items in increasing order. It steps through the array and compares the adjacent elements. If they are not sorted, it swaps them. It then keeps repeating the procedure until the array is fully sorted. Let’s jump into an example. The following elements are compared during the first iteration: 0 and 1, 1 and 2, 2 and 3, 3 and 4, and 4 and 5. In the first comparison of the first iteration, elements at indices 0 and 1 are compared. Since 3 is less than 7, the elements
Should you document your code? PHP has a few different options when it comes to comments. Frequently, it’s based on preference on which comment style you use, but other times it makes sense to use one over the other. PHP Comments allow you to write brief or detailed descriptions explaining what the code that you wrote actually does. You, or someone else, will come back to your code years from now and will try to decipher what it actually means. You should always strive to write code that’s self-explanatory, but every once in while, you may want to specify a