Basic PHP and basic syntax in October 15, 2014

Source: Internet
Author: User
PHP basics I was going to talk about DivCSS today and found that I am not very familiar with Div, so I will try to use the package: wamp later and install it all the way. Programming Software: sublime, or do not use DW, a powerful prompt-carrying tool. After wamp is installed, run wamp and create a test. php file under the www directory.

PHP basics I was going to talk about DivCSS today and found that I am not very familiar with Div, so I will try to use the package: wamp later and install it all the way. Programming Software: sublime, or do not use DW, a powerful prompt-carrying tool. After wamp is installed, run wamp and create a test. php file under the www directory.

PHP Basics

Today I want to talk about Div + CSS. I found that I am not very familiar with Div, so I will talk about it later.

Directly use the package: wamp, and install it all the way down.

Programming Software: sublime, or do not use DW, a powerful prompt-carrying tool.

After wamp is installed, run wamp, create a test. php file under the www directory, and open it with sublime

Write the Code:

 
Open 127.0.0.1/test. php in a browser and a webpage appears,

This webpage includes PHP compilation and extension information, PHP version, server information and environment, and so on. This indicates that the environment is successfully installed.


PHP basic syntax


PHP is the script language used for the server.

Let's see what it can do:

1. Collect form data

2. generate dynamic web pages

3. string processing

4. Dynamic Output Image

5. process the file system on the server

6. Compile the web pages supported by the database

7. session tracking control

8. Process XML files

9. support using a large number of network protocols

10. Other operations on the server


Let's talk about PHP and HTML code mixing.
Here is an example:

<? Php echo "this is the title"?>
 
 
 
Title Content
While (get data from database ){ }

How can I modify this code so that it can be executed? The following code

 Pack them up?>
 
 
 

For PHP annotations, // **/can be used. # annotations are rarely used.


Variable Declaration

PHP is a weak language. If it is not defined first, you can use it when and when. In addition, it does not divide variables into many types like the C language. When you define it, what type is assigned, and what type is it

For example:

 
There is also an array type, which is not as strict as other languages, and the data in it must be of the same type. The PHP array is actually an ordered graph, and its subscript and data are the relationship of key => value.

Example:

 "12312", 12 => 123333, 13 => true); // print the array print_r ($ arrayName); // print the data according to the subscript echo $ arrayName ["name"]; echo $ arrayName [12]; echo $ arrayName [13];?>
Type forced conversion

 
So much today

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.