PHP Note 01

Source: Internet
Author: User

PHP Output statements

(1) echo "helloworld! ";---echo command
(2) print (); The output statement is a function that has a return value. The output returned successfully to 1, and the failure returned 0.
(3) printf (); Format the output string. Example: printf ("%d,%f", 12,12.3);
(4) sprintf (); Format the stitching string, not the output statement, but only the string concatenation.
(5) Print_r (); Output arrays, objects, and other composite data types

1. Implicit conversions

$a = 1;

$b = 1.22;

$a = $b;

2. Casting

 

GetType ($ variable);

Settype ($ variable, "type")

Intval ($a)//$a data type unchanged, intval ($a) whole becomes shaping, zero conversion

Isset ()//variable exists

Unset ()//Destroy variable

Empty

function: Check if a variable is empty
* Return value:
* Returns TRUE if the variable does not exist
* If the variable exists and its value is "", 0, "0", NULL, FALSE, Array (), Var $var; and objects that do not have any properties, the TURE is returned.
* If the variable exists and the value is not "", 0, "0", NULL, FALSE, Array (), Var $var; And an object that does not have any properties, it returns FALSE

Judging variable types

Is_array (variable); Determine if the variable is an array, the following usage is the same

Array,double,float,real,long,int,integer,string,object,resourse,null,numeric

PHP Note 01

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.