Learn and remember--php Quick Start basics

Source: Internet
Author: User

PHP is an explanatory scripting language.

You can write HTML, CSS, JavaScript, and PHP in a php file to form a page for the browser to interpret the rendering. You can also use PHP as a service-side language for logical processing, and to connect to the database.


1. Using PHP
<?php
#这里是php代码
echo "Hello World";
?>

2.php function, class, keyword case insensitive; all variables are case-sensitive.


3. The variable starts with $, and the name begins with a letter or an underscore. No declaration is required and is created when the first assignment is made. If the type.

4. Scope
Local: in-function declaration
Global: Out-of-function declaration. $GLOBALS [V_name] stores all global variables in an array
Static: Not recycled at the end of a function call

5. Output
Echo: Output more than one string, no return value
Print: Outputs a string that always returns 1

6. Data type
String: Single quotation mark
Integer: 0x 16-Binary 8-binary
Floating point number
Logic
Array
Object
Null

7. String functions
strlen () string length
Strpos () retrieving characters or text

8. Constants
Define ("greeting", "Hello"); Once assigned, can no longer be changed.

9. Functions
Functions Func1 () {} function name is not case sensitive
function Func2 ($min =1) {...} set default value for parameter

10. Arrays
Indexed array
Associative arrays
Multidimensional arrays

11. Sorting
Sort () Rsort () a sort () Ksort () Arsort () Krsort ()

12. Super Global variables
$GLOBALS $_server $_request $_post $_get $_files $_env $_cookie $_session

13. Database
Mysql_connect functions such as php5.5 are no longer supported
Use the MYSQLI library function instead

Learn and remember--php Quick Start basics

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.