PHP Beginner's mind

Source: Internet
Author: User
Tags array sort

Start and end tags
    1. There are two common types: <?php ?><script language="php"></script>
    2. Short mark: <? ?> , need to open the short_open_tag instruction of php.ini file
    3. ASP style tag: <% %> , need to open the asp_tags instruction of php.ini file
PHP Data type (9 types)
    1. Four types of scalar
    • Boolean
    • Integer
    • Float
    • String
    1. Three types of composite
    • Array
    • Object
    • Callable (callable)
    1. Two special types of
    • Resource (resources)
    • NULL (no type)
    1. Pseudo type
    • Mixed (mixed type)
    • Number (numeric type)
    • Callback (callback type, also known as callable)
    • Array|object
    • void
    1. Pseudo-Variable $ ...
    2. Type detection function (is_type), eg:is_string($str)
Super Global variables
    • $GLOBALS
    • $_server: Saving information about headers, paths, script locations, and more
    • $_request: Collecting data submitted by HTML forms
    • $_post
    • $_get
    • $_files
    • $_env
    • $_cookie
    • $_session
Accessing global variables in a function body
    • Global $variable _name
    • $GLOBALS [Variable_name]
Set constants

define(const_name, const_value, boolean)

    • Const_name: Constant Name
    • Const_value: Constant Value
    • Boolean: Constant name case sensitive, default false sensitive, true insensitive
Create an array
    • array()
    • Get array lengthcount($arr)
    • Array sort: Ascending sort() , descendingrsort()
    • Array key sort: ascending ksort() , descendingkrsort()
    • Array value sort: ascending asort() , descendingarsort()
foreach Loop (for arrays only)
    • foreach($array as $value) {}
    • foreach($array as $key => $value) {}
Magic variable
    • __LINE__: Current line number
    • __FILE__: File full path and filename
    • __DIR__: The directory where the files are located
    • __FUNCTION__: function name
    • __METHOD__: The method name of the class
    • __NAMESPACE__: The name of the current namespace
Object oriented
    • class uses the class keyword followed by the name definition
    • Variables and methods can be defined within a pair of curly braces ({}) after the class name
    • A variable of a class is declared with Var, and a variable can initialize a value
    • A function defines the definition of a PHP function, but is accessible only through the class and its instantiated objects

PHP Beginner's mind

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.