PHP common symbols and functions you must know to play

Source: Internet
Author: User
Tags array functions integer lowercase string format variable

 

Variable shape:   one is true;   The other is false or false   common variable form:   string string (digit \ Kanji \ etc.)   integer integer (1, 2, 3, 4, 5, 0,-1,-2, etc.)   double floating-point number (small points)   Array   Object   available methods are GetType ($mix) and Settype ($mix, $typename);       Common symbols   \ "Double quotes   \ backslash"   \ line break   \ r send out   T-hop (TAB)   operation symbol   + addition shipping Count – Subtraction   * Multiplication Operations/Division operations  % take remainder + + cumulative  – 1. Add strings   Set operations   = Turn the value on the right to the left (must)   + = Add the right value to the left  -= to reduce the value on the right to the left of   *= the left value by the right  /= the value to the left by dividing the right   = Add the right string to the left   bitwise operation   & and   or   ^ Mutex (XOR)   << left shift   >> right Shift &nbsp ; ~ Take 1 of the complement   logic operation   < less than > greater than   <= is less than or equal to >= greater than or equal to  != not equal to && and   or! No   other operational symbols   $ variable symbol   & variable index (added to variable)   @ does not display error message (added to function)  -> object's method or property   => array element value  ? : Ternary operator   Basic method   1.PHP conversion string is case-insensitive!   Strtolower (); Turn characters to lowercase strtoupper (); Capitalize   2.PHP encrypted strings (uppercase and lowercase)   MD5 (); encrypt SHA1 (); About quotes   One, single quotes are the same as output two, double quotation marks are the contents of the interpretation of the output three, inverted single quotes is to execute a command, such as ' PWD '. Four, "\" role in the translation of characters, such as "\ n" for line-wrapping!   4. Function: Htmlspecialchars () This function converts a special character to an HTML string format (&....;). The most commonly used occasions may be to deal with the message version of the customer message.   & (and) Turn to & "(double quotes) into" < (less than) into < > (greater than) into >   This function converts only the special characters above, and does not convert all to the ASCII conversion as defined in HTML 。   5. Bulk Output HTML content!   echo <<< EOT HTML output ... Here the annotation still output! EOT;   Print <<<eot HTML output ... Here the annotation still output! EOT; (Note: Internal contains variables with "{variable}")   6. Determine if the file exists and output   <?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 whether a variable is an integer; 9.is_null; Detects whether the variable is NULL; 10.is_string detect whether the variable is a string 11.is_real; Is_float () Alias 12.isset detects whether the variable is set 13.is_bool whether the variable is a Boolean 14.is_array detect whether the variable is an array 15.is_object detect whether the variable is an object 16.SubStr. SUBSTR (String,start,selectnum) echosubstr (' 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"); Turn the escaped newline into an HTML <br/>

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.