SSaad insaadlittleworld.hashnode.dev·Jan 3, 2023 · 2 min readPHP Functions and FilteringWe can think of a function as a verb to do something, functions are a set of instructions on what we want to do. Let's filter our book array so we only get back the books that are written by Andry Wei, to solve that we could just use the conditional ...00
SSaad insaadlittleworld.hashnode.dev·Jan 2, 2023 · 1 min readPHP Associative ArraysAssociative arrays are arrays where we pair a key with a value, each key in the array gives a value let's see an example: here we have an array of books where we have two books, and each book is represented with an array, inside the array we have ke...00
SSaad insaadlittleworld.hashnode.dev·Jan 2, 2023 · 1 min readPHP ArraysAn array is like a folder, we can take a group or list of things and put it in the array, if we want to represent a list of our favorite books, for example, we can use an array. To loop over the array of books we use the foreach function : The resu...00
SSaad insaadlittleworld.hashnode.dev·Jan 2, 2023 · 1 min readPHP Conditionals and BooleansA boolean variable can only be true or false; We declared the variable $name as the name of the book, and the variable $read as our boolean variable, if it's true then the user reads the book, if it's false then the user didn't read it. if($read) { ...01C
SSaad insaadlittleworld.hashnode.dev·Jan 2, 2023 · 1 min readHow to declare a variable in PHPTo declare a variable in PHP we write the $ sign before the name of the variable : for example, let's declare a variable named greeting and assign the string Hello to it. $greeting="Hello" we can echo out this variable like this: echo "$greeting Worl...00