HTML friendly loops

for loop Instead of brackets you can use : and endfor;, to make a loop much easier to see within HTML code foreach loop Same, but the end keyword is endforeach; while loop Same, but the end keyword is endwhile;

Read More

Inheritance of a class

Create a class that inherits from a parent class Define a class that inherits from another Now, objects of class MyChildClass can call MyChildFunction(), but objects of MyParentClass can’t. Overriding functions in a parent class Protected members Members (variables, functions, etc) can be defined with one of the following protection levels:

Read More

Create a new class

Define the class Use the class Constructor The constructor function is optional, if defined it is automatically called when an object is instantiated.

Read More

Using regex in PHP

preg_match() Does input string match regex expression preg_replace() Replace any characters that don’t match the regex expression with character from another string. You can make the replacement string empty to simply remove unwanted characters Remove all characters that are not numbers example

Read More

Regex examples

North American telephone number Test for 10-digit North American telephone numbers. Will allow spaces, hyphens, or periods as optional separators as well as optional parentheses around the first three numbers

Read More

.Regex

Regular expressions operate by moving character by character, from left to right, through a piece of text. When regex finds a character that matches the first piece of the expression, it looks to find a continuous sequence of matching characters. Match text abc Match the string “abc” Alternation abc|def Match the string “abc” OR “def”Note […]

Read More