The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes: foreach (iterable_expression as $value) statement foreach (iterable_expression as $key => $value) statement The first […]
The SELECT statement is used to select data from one or more tables: or we can use the * character to select ALL columns from a table Example (MySQLi Object-oriented)
Loops are handy, if you want to run the same code over and over again, each time with a different value. Often this is the case when working with arrays: Example: Different Kinds of Loops JavaScript supports different kinds of loops: for – loops through a block of code a number of times for/in – loops through […]
An array stores multiple values in one single variable: Example: What is an Array? An array is a special variable, which can hold more than one value at a time. If you have a list of items (a list of car names, for example), storing the cars in single variables could look like this: However, […]
preg_replace — Perform a regular expression search and replace Description Examples Example #1 Using backreferences followed by numeric literals The above example will output:
str_replace — Replace all occurrences of the search string with the replacement string Description If you don’t need fancy replacing rules (like regular expressions), you should use this function instead of preg_replace(). This function returns a string or an array with all occurrences of search in subject replaced with the given replace value. Examples Example #1 Basic str_replace() examples