PHP Common Symbols and functions

Source: Internet
Author: User
Tags autoload

Recently in the writing PHP program found some special PHP symbols, such as continuous less than the symbol, three less than the symbol, eot,eod,echo example, print example, suddenly found that with so long PHP, even PHP basic symbols are not recognized, See the @ also looked for a long while to know what meaning. Put the basic symbols and some common PHP symbols outside the list, in my blog post it, the need for friends can refer to the special PHP related symbols ~
Annotation symbols:

Single-line annotations

/* * * Multi-line annotations

Use of quotation marks

' Single quotation marks, without any meaning, are brought directly over by any treatment;

"" Double quotes, PHP dynamic processing then output, typically used for variables.

Variable pattern:

One is true, that is true;

The other is false or false.

Common variant Patterns:

string strings (numeric \ Kanji \ etc)

Integer integers (1, 2, 3, 4, 5, 0, 1, 2, and so on)

Double floating point number (decimal point)

Array arrays

Object objects

Available methods are GetType ($mix) and Settype ($mix, $typename);

Common symbols

\ "Double quotation marks

\ \ Backslash

\ nthe line break

\ r send out

\ t-hop (TAB)

Operation symbols

+ Addition operations – subtraction operations

* Multiplication Operation/division operation

% take remainder + + accumulate

– 1 reduction in fatigue. Add the strings together

Set operation

= Put the value on the right to the left (must be)

+ = Add the right value to the left

-= reduce the value on the right to the left

*= multiply the left value by the right.

/= divide the left value to the right

. = Add the right string to the left

Bit operator

& and

| Or

^ Mutex (XOR)

<< left Shift

>> Right Shift

~ Take 1 of the complement

Logical operations

< less than > greater than

<= less than or equal to >= greater than or equal

! = does not equal && and

|| Or! No

Other operational symbols

$ variable Symbol

Indicator of the & variable (before the variable)

@ Do not display error message (added before function)

The method or property of the object

= = element value of array

? : Ternary operator

Basic methods

1.PHP convert string to case!

Strtolower (); Turn character to lowercase
Strtoupper (); Turn characters into uppercase

2.PHP Encrypted string (case-sensitive)

MD5 (); encryption
SHA1 (); encryption

3. About quotation marks

One, single quotation marks are output as-is
Two, double quotation mark is the content explanation carries on the output
Third, anti-single quotation marks are the execution of a command, such as ' pwd '.
Four, "\" role in the translation of characters, such as "\ n" for line-wrapping!

4. Function: Htmlspecialchars ()
This function turns special characters into HTML string format (&....;). The most commonly used occasion may be to deal with the message of the customer message version.

& (and) turn into &
"(double quotation marks) to turn"
< (less than) turn into &lt;
> (greater than) turn into &gt;

This function converts only the above special characters, and does not convert all of the ASCII conversions specified by the HTML.

5. Batch Output HTML content!

Echo <<< EOT
HTML Output content ... Here the comment output!
EOT;

Print <<<eot
HTML Output content ... Here the comment output!
EOT;
(Note: internal contains variable with "{variable}")

6. Determine if the file exists and output the content

<?php
$FileName = "File.TXT";
if (file_exists ($FileName)) {
Echo "<xmp>". File_get_contents ($FileName). " </xmp> ";
}else
{
Echo "No";
}
?>

7. Unload variable unset;

Unset ($var);
Unset ($var, $var 1);

8.is_int;
Detects if the variable is an integer;
9.is_null;
Detects if the variable is NULL;
10.is_string
Detects if a variable is a string
11.is_real;
Alias for Is_float ()
12.isset
Detect if a variable is set
13.is_bool
Detects if a variable is a Boolean type
14.is_array
Detects if a variable is an array
15.is_object
Detects if a variable is an object
16.SubStr.
SUBSTR (String,start,selectnum)
echo substr (' abcdef ', 1); Bcdef
echo substr (' abcdef ', 1, 3); Bcd
echo substr (' abcdef ', 0, 4); Abcd
echo substr (' abcdef ', 0, 8); ABCdef
echo substr (' abcdef ',-1, 1); F
17.nb2br
echo nl2br ("foo isn ' t\n bar");
Turns the escaped newline into the HTML <br/>

Original: http://y312ff.blog.163.com/blog/static/12701109420119119575812/

LAZYCMS:: $sysname

The first time I saw this expression, what do you mean by double colon?

For:
A method or property of a direct genus.

That is, static method or property use.
Domain operators, which are generally used to use the Class A object's properties/Methods in Class B objects!
Class C
{
private static $_memory;

public static function AutoLoad ()
{
Method body
}
}

C::$_memory;
C:: AutoLoad ();

PHP Common Symbols and functions

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.