Creating a loop of Bootstrap Modals
To create a loop of Bootstrap style modals on a page, you can use a foreach or while loop in PHP. First, let’s do the code for one modal. Single Modal Code <!– Button to Open the Modal –> <button type=”button” class=”btn btn-primary” data-toggle=”modal” data-target=”#myModal”> Open modal </button> <!– The Modal –> <div class=”modal” id=”myModal”>…
Read MoreAdd Copyright Symbol and Year Date in PHP
To add a copyright symbol and year date in PHP that updates with the current year, you can use the code below… © <?php echo date (‘Y’); ?> An HTML entity is used for the copyright symbol, then you have an opening PHP declaration followed by an echo, which is rendering the year using the…
Read MoreWhat is a reference assignment in PHP?
A reference assignment in PHP in respect of variables is when a variable references another variable. So for example 2 variables… $a = ‘red’; $b = ‘blue’; echo $a . ‘<br>’; echo $b . ‘<br>’; The first echo output will produce ‘red’ and ‘blue’ Now change $b to reference $a $b =& $a; echo $a…
Read MoreWhat are Classes and Methods in OOP PHP
This tutorial is a beginners look at OOP(object oriented programming) in PHP and covers what a class, method and variables are as well as how to instantiate a class and add variables to it. a class in OOP Php A class in php is an object in object oriented programming or OOP, the class defines…
Read MoreOutput a random string on each page load in PHP
To output a random string from an array on each page load you can use the array_rand function in PHP. So in the above snippet the array is created and assigned to the $input variable, it is then output using echo and passing the $input variable initially to array_rand and the result of that being assigned…
Read More