Posts by Sam Matrouh

PHP Basics – Multiply two numbers

Multiplying two numbers is a trivial task in most programming languages. We’ll have a look at a few approaches using PHP. Basic 2 * 2 Let’s assign that to a variable named integer like so: $integer = 2 * 2; Let’s use the echo statement to output the results. Here’s what the full code looks like. Creating a simple function In this section, we’ll create a simple function called multiply. Our function that takes two parameters. We’ll use variables $a and $b to pass in our arguments. function multiply($a,$b) {}… Read More