Year: 2022

JavaScript

Change the Text of a Div Element using JavaScript

Use the textContent property to change the text of a div element, e.g. div.textContent = ‘Replacement text’. The textContent property will set the text of the div to the provided string, replacing any of the existing content. Here is the HTML for the examples in this article. index.html And here is the related JavaScript code. index.js We used the textContent property on the div to change its text […]

Loading

Read More
PHP

Validate Password Strength using PHP

When the user provides their account password, it is always recommended to validate the input. Password strength validation is very useful to check whether the password is strong. A strong password makes the user’s account secure and helps to prevent account hacking. Using Regex (Regular Expression), you can easily validate the password strength in PHP. […]

Loading

Read More
Linux

Backup a website using bash script.

I needed to complete a routine backup of my development websites on my home server. This was pretty easily completed by daily by a bash script. Here is a simple script that backs up the database and all the files. For the example below I’m using Maria DB 10.5 and my project files are located […]

Loading

Read More
PHP

An Introduction to Classes and Objects in PHP 8+

What is OOP? Object-oriented programming (OOP) is a computer programming model that organizes software design around objects rather than single functions. An object can be defined as a data field that has unique attributes and behavior. A class is a container for objects to be manipulated using methods (internal functions). OOP Let’s assume we have […]

Loading

Read More