oa credit loophole -PHP 5 disk data types

String (String), OA credit erected tray Q <319.135.503.1>
Integer (integer), Float (float), Boolean (Boolean), Array (arrays), Object (Object), NULL (null) .

PHP string
a sequence string is a string of characters, like "Hello world!".

You can put any text in single quotes and double quotes:

实例
<?php
$x = "Hello world!";
echo $x;
echo "<br>";
$x = 'Hello world!';
echo $x;
?>

try it"

PHP Integer
Integer is a no decimals.

Integer rules:

There must be an integer of at least a number (0-9)
integer not contain a comma or space
integer decimal point is not
an integer may be positive or negative
integers may be specified in the following formats: decimal, hexadecimal (prefixed with 0x) or octal (prefixed with 0).
In the following example we will test different numbers.

PHP var_dump () function returns the variable data type and value:

Examples
? <PHP
$ = the X-5985;
var_dump (the X-$);
echo "<br>";
$ the X-= -345; // negative
var_dump (the X-$);
echo "<br>";
$ = 0x8C the X-; / / hexadecimal number
var_dump (the X-$);
echo "<br>";
$ = the X-047; // octal
var_dump (the X-$);
?>

try it"

PHP Float
Float is a number with a fractional part, or exponential form.

In the following example we will test different numbers. PHP var_dump () function returns the variable data type and value:

实例
<?php
$x = 10.365;
var_dump($x);
echo "<br>";
$x = 2.4e3;
var_dump($x);
echo "<br>";
$x = 8E-5;
var_dump($x);
?>

try it"

PHP Boolean
Boolean can be TRUE or FALSE.

to true X = $;
$ Y = to false;
boolean condition commonly used for determination. In the next chapter you will learn more about the tutorial controlled conditions.

PHP array
array of a plurality of values may be stored in a variable.

Create an array in the following examples, then PHP var_dump () function returns the type and value of the array data:

实例
<?php
$cars=array("Volvo","BMW","Toyota");
var_dump($cars);
?>

Try >>
In the next chapter you will learn more about the array.

PHP object
object data types may also be used to store data.

In PHP, the object must be declared.

First, you must use the class keyword to declare a class object. Class can contain structural properties and methods.

Then we then use the data type in the example of the class in the class defined data types:

实例
<?php
class Car
{
var $color;
function __construct($color="green") {
$this->color = $color;
}
function what_color() {
return $this->color;
}
}
?>

Try >>
example above PHP keyword this is a pointer to the current object instance, does not point to any other object or class.

You'll learn more about objects in the next section.

PHP NULL value
NULL value represents a variable has no value. NULL NULL value is of the data type.

NULL value indicating whether a variable is null. Also it is used to distinguish between data and the NULL value null values.

NULL value can be cleared by setting the variable to the variable data:

实例
<?php
$x="Hello world!";
$x=null;
var_dump($x);
?>

Guess you like

Origin blog.51cto.com/14524882/2434555