• PHP - Escape Characters
    Escape Character To insert characters that are illegal in a string, use an escape character. An escape character is a backslash \ followed by the character you want to insert. An example of an illegal character is a double quote inside a string that is surrounded by double quotes: ExampleGet your own PHP Server $x = "We are the so-called "Vikings" from the north."; Try it...
    0 Reacties 0 aandelen 7K Views 0 voorbeeld
  • PHP Numbers
    In this chapter we will look in depth into Integers, Floats, and Number Strings. PHP Numbers There are three main numeric types in PHP: Integer Float Number Strings In addition, PHP has two more data types used for numbers: Infinity NaN Variables of numeric types are created when you assign a value to them: ExampleGet your own PHP Server $a = 5; $b = 5.34; $c = "25";...
    0 Reacties 0 aandelen 4K Views 0 voorbeeld
  • PHP Casting
    Sometimes you need to change a variable from one data type into another, and sometimes you want a variable to have a specific data type. This can be done with casting. Change Data Type Casting in PHP is done with these statements: (string) - Converts to data type String (int) - Converts to data type Integer (float) - Converts to data type Float (bool) - Converts to...
    0 Reacties 0 aandelen 3K Views 0 voorbeeld
  • PHP Math
    PHP has a set of math functions that allows you to perform mathematical tasks on numbers. PHP pi() Function The pi() function returns the value of PI: ExampleGet your own PHP Server echo(pi()); Try it Yourself » PHP min() and max() Functions The min() and max() functions can be used to find the lowest or highest value in a list of arguments:...
    0 Reacties 0 aandelen 4K Views 0 voorbeeld
  • PHP Constants
    Constants are like variables, except that once they are defined they cannot be changed or undefined. PHP Constants A constant is an identifier (name) for a simple value. The value cannot be changed during the script. A valid constant name starts with a letter or underscore (no $ sign before the constant name). Note: Unlike variables, constants are automatically global across the...
    0 Reacties 0 aandelen 5K Views 0 voorbeeld
  • PHP Magic Constants
    PHP Predefined Constants PHP has nine predefined constants that change value depending on where they are used, and therefor they are called "magic constants". These magic constants are written with a double underscore at the start and the end, except for the ClassName::class constant. Magic Constants Here are the magic constants, with descriptions and examples: Constant...
    0 Reacties 0 aandelen 3K Views 0 voorbeeld
  • PHP Operators
    PHP Operators Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: Arithmetic operators Assignment operators Comparison operators Increment/Decrement operators Logical operators String operators Array operators Conditional assignment operators PHP Arithmetic Operators The PHP arithmetic operators are used with...
    0 Reacties 0 aandelen 6K Views 0 voorbeeld
  • PHP if Statements
    Conditional statements are used to perform different actions based on different conditions. PHP Conditional Statements Very often when you write code, you want to perform different actions for different conditions. You can use conditional statements in your code to do this. In PHP we have the following conditional statements: if statement - executes some code if one condition is...
    0 Reacties 0 aandelen 3K Views 0 voorbeeld
  • PHP if Operators
    Comparison Operators If statements usually contain conditions that compare two values. ExampleGet your own PHP Server Check if $t is equal to 14: $t = 14; if ($t == 14) { echo "Have a good day!"; } Try it Yourself » To compare two values, we need to use a comparison operator. Here are the PHP comparison operators to use in if statements:...
    0 Reacties 0 aandelen 3K Views 0 voorbeeld
  • PHP if...else Statements
    PHP - The if...else Statement The if...else statement executes some code if a condition is true and another code if that condition is false. Syntax if (condition) { // code to be executed if condition is true; } else { // code to be executed if condition is false; } ExampleGet your own PHP Server Output "Have a good day!" if the current time is less than 20, and "Have...
    0 Reacties 0 aandelen 3K Views 0 voorbeeld