View code <? PHP
// Print, Echo Functions
Print "This is my first Program <Br> ";
$ Word = "This is my second Program <br> ";
Print $ Word ;
Echo "3rd programs <br> ";
//Printf
Printf("% '* 10.2f", 456.7 );
Echo"<Br> ";
Printf("% B", 8 );
Echo"<Br> ";
//Sprintf
$ Content= "Script language ";
$ App= "Web ";
$ Formatted=Sprintf("<H4> PHP is widely used in Embedded % A, especially suitable for % s development. </H4> ",$ Content,$ App);
Echo $ Formatted;
// print_r
echo "
";
$ name = array (" Zhang San "," Li Si "," Wang Wu ", "sat");
print_r ($ name );
// is is_bool a Boolean integer, whether is_int is an integer, whether is_float is float, and whether the string Escape Character "\"
echo "
";
echo "
";
$ I = 10;
If ( is_int ( $ I )) {
echo "I is an integer ";
}< br> else {
echo " I is not an integer ";
}< br> echo "
";
echo "
";
//Heredoc text output heredoc_mark is randomly named, followed by ";"
$ Doc= <Heredoc_mark
Hello! <Br>
Happy Birthday! <Br>
Heredoc_mark;
Echo $ Doc;
// is_object is an object type with a lag, whether is_resource is a resource type, whether is_null is null, unset clear variable assignment
echo "
";
$ I = 0; /// it is not a null type. The following is a null type: 1. the value is null. 2. no new variable is assigned. 3.
If ( is_null (k k ) {
echo " this is a null variable ";
}< br> else {
echo " This is not a null variable ";
}
// forced conversion of data types, it is not recommended to use automatic conversion. It is not clear enough.
$ Val = 11.78;
$ Val = (INT) $ Val ;
echo $ Val ;
//Functions related to data types
/*
* GetType (): return the Data Type of the specified variable.
* Settype (): You can set a variable to a specified type.
* Is_float (): determines if it is a floating point number.
* Is_array (): determines whether it is an array.
* Is_string (): determines whether it is a string.
* Is_integer (): determines whether it is an integer.
* Is_null (): determines whether it is null.
* Is_resource (): determines whether it is a resource type.
* Is_numeric (): determines whether it is a numerical value.
* Is_scalar (): determines whether the title type is used. The so-called "title type" refers to the type that contains only one item of information, such as Boolean, integer, floating point, and numeric, while array, object, and Other types include multiple items of information, therefore, it does not belong to the title type.
*/
//Settype ($ Val, string); Convert Val to string type
// GetType ($ name) Get the $ name Type
?>