PHP Arrays

PHP arrays

An array is a collection of related values (a list of items) such as names of cities Creating an array To create an array use the function array() like: Numeric Arrays Numeric Arrays are arrays that use only numeric keys, called as numeric, indexed or ordered arrays. Associative Arrays Associative arrays are arrays that use …

PHP Conditional Statements: if else, switch

PHP arrays

If statement Execute the code if the condition is true If…else statement Switch statement Execute different code depending on a condition. The switch statement is similar to a series of IF statements If the value pass to the switch statement matches, the code that follows the case is executed. Example: Be careful! if we forget …

Difference between single-quoted and double-quoted

PHP arrays

The most important difference between single and double quote, is that anything enclosed in single quotes is treated as literal text. Single quotes When using single quotes we must take care with apostrophes. To use the apostrophe in single quotes, we have to put backslash before apostrophe (which is named as escape character). The backslash …

JavaScript Loops while, for, do while

javascript

JavaScript Loops JavaScript loops are used to execute the same code multiple times. They can execute a block of code as long as a specified condition is true.   The While Loop The while loop execute a block of code as long as a specified condition is true. The While loop has the following syntax: …

JavaScript conditional statements

javascript

If statement The if statement is used to specify a block of JavaScript code that is executed, if a condition is true.   Example If You want to execute a single line of code in an if statement, is not necessarily to put curly braces in. However it’s a good practice to always use curly …

Javascript output, alert, console.log, innerHTML

javascript

About JavaScript Output JavaScript does not have built-in functions for display, but we are able to display data in different ways: into an alert box, using alert() method which displays an alert box with a specified message;   into the browser console, using console.log(). You may pass as many arguments as you’d like;   into …

Javascript variables, rules, examples

javascript

In other programming languages when you define a variable, you must specify its type, ie what type of information will be stored in the variable, like integer, boolean, array, etc; JavaScript is different! In JavaScript we create a generic variable and then put whatever type of value we want in it. To create a variable …

Page 1 of 3
1 2 3