Posts

Float

Home  >> Data Types   >> Float Float Floating point numbers (also known as "floats", "doubles", or "real numbers") can be specified using any of the following syntaxes: <?php $a  =  1.234 ;  $b  =  1.2e3 ;  $c  =  7E-10 ; ?> Formally LNUM          [0-9]+ DNUM          ([0-9]*[\.]{LNUM}) | ({LNUM}[\.][0-9]*) EXPONENT_DNUM [+-]?(({LNUM} | {DNUM}) [eE][+-]? {LNUM}) The size of a float is platform-dependent, although a maximum of ~1.8e308 with a precision of roughly 14 decimal digits is a common value (the 64 bit IEEE format). Floating point precision Floating point numbers have limited precision. Although it depends on the system, PHP typically uses the IEEE 754 double precision format, which will give a maximum relative error due to rounding in the order of 1.11e-16. Non elementary arithmetic ...

Integer

Home  >> Data Types   >> Integer Integer Integers can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8) or binary (base 2) notation, optionally preceded by a sign (- or +). Binary Integer literals are also available since PHP 5.4.0 . To use octal notation, precede the number with a 0 (zero). To use hexadecimal notation precede the number with 0x . To use binary notation precede the number with 0b . Structure decimal [1-9][0-9]* | 0 hexadecimal 0[xX][0-9a-fA-F]+ octal 0[0-7]+ binary 0b[01]+ integer      [+-]?decimal | [+-]?hexadecimal | [+-]?octal | [+-]?binary Example: <?php $a  =  1510 ;  // decimal number $a  = - 151 ;  // a negative number $a  =  0123 ;  // octal number (equivalent to 83 decimal)...

Boolean Type

Home  >> Data Types   >> Boolean The boolean type returns the value either TRUE or FALSE Syntax In order to specify the boolean variable, use the constants TRUE or FALSE. Both are case-insensitive <?php $coderz  =  True ;  // assign the value TRUE to $coderz ?> Typically, the   control structure depends upon the value of boolean operator. Because, it returns either TRUE or FALSE <?php // == is an operator which tests // equality and returns a boolean if ( $name ==  "coderz" ) {     echo  "Coderztoday is the best online tutorial" ; } // this is not necessary... if ( $name ==TRUE) {     echo  "<hr>\n" ; } // ...because this can be used with exactly the...

Introduction

Home  >> Data Types   >> Introduction PHP supports the following primitive types Scalar type boolean integer float  (floating-point number, aka  double ) String Compound type array object callable Iterable Two special type   resource NULL

Types

Home  >> Data Types   Table of contents Introduction Boolean Integers Floating point numbers Strings Arrays Iterables Objects Resources NULL

Comments

Home  >> Basic PHP Syntax   >> Comments Comments PHP supports 'C', 'C++' and Unix shell-style (Perl style) comments. For example: <?php      echo  'Coders today' ;  // This is a one-line c++ style comment     /* This is a multi line comment        yet another line of comment */      echo  'Coderztoday' ;     echo  'Coders today' ;  # This is a one-line shell-style comment ?> The "one-line" comment styles only comment to the end of the line or the current block of PHP code, whichever comes first. This means that HTML code after // ... ?> or # ... ?> WILL be printed: ?> breaks out of PHP mode and returns to HTML mode, and // or # cannot influence that. <h1>T...

Instruction Seperation

Home  >> Basic PHP Syntax   >> Instruction Seperation Separation of Code Like many programming languages, PHP requires coding instructions to be terminated with a semicolon at the end of each statement. The closing tag of a block of PHP code automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a PHP block. The closing tag for the block will include the immediately trailing newline if one is present. <?php      echo  'Coders today' ; ?> <?php  echo  'Coderstoday - Learn Programming in an easy way'  ?> <?php  echo  'Coderztoday' ; Note:   The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include or require, so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later...