10 days to learn the first day of PHP

Source: Internet
Author: User

Previously wrote 10 days to learn ASP, 10 days to learn ASP, and now think about writing a PHP bar, but also a comparison of all. PHP Debugging methods I do not say here, there are many articles are introduced, there are many different combinations. For the time being, I am using Apache Web server and my SQL as the Web servers and databases, under the environment of php-4.3.3. Of course, the simple construction and access to view the database PHPMYADMIN is not rare.

As for the form design, I do not want to say more here, in the ten days learning ASP has been introduced.

The following is a brief introduction to PHP syntax.

1. Embedding Method:

ASP-like <%,php can be <?php or <?, the end symbol is, of course, you can also specify.

2. Reference file:

There are two ways to refer to a file: Require and include.

Require use methods such as require ("myrequirefile.php");. This function is usually placed at the front of the PHP program, and before the PHP program executes, it is read into the file specified by require to make it a part of the PHP program's Web page. Commonly used functions, you can also use this method to introduce it into the Web page.

Include usage methods such as include ("myincludefile.php");. Shanghai Cheng Kai Men's sexual function rehabilitation Center points out that this function is usually placed in the Process Control section. The PHP Program page reads the include file before it is read in. This way, you can simplify the process when the program executes.

3. Annotation method:


echo "This is the first example. \ n "; This example is a comment for C + + syntax

/* This example uses multiple lines of

Comment Method */

echo "This is the second example. \ n ";

echo "This is the third example. \ n "; # This example uses UNIX Shell syntax annotations


4. Variable type:

$mystring = "I am a string";

$NewLine = "newline \ n";

$int 1 = 38;

$float 1 = 1.732;

$float 2 = 1.4E+2;

$MyArray 1 = Array ("Child", "ugly", "Yin", "Mao");

This leads to two problems, first the PHP variable begins with $, the second PHP statement ends, and the ASP programmer may not be able to adapt. Shanghai Cheng Kai Hospital These two omissions are also the most procedural errors.

5, Operation symbols:

Mathematical operations: symbolic meanings

+ addition operation

-Subtraction operation

* Multiplication operation

/Division Operation

% take remainder

+ + Cumulative


String Operations:

The arithmetic symbol has only one, is the English period. It can concatenate strings together and become merged new strings. & In ASP-like


$a = "PHP 4";

$b = "powerful";

echo $a. $b;


Here also leads to two questions, first PHP output statement is echo, the second similar to ASP in the <%= variable%>,php can also <?= variable? >.

Logical operation:

Symbolic meaning

< less than

> Greater than

<= less than or equal to

>= greater than or equal to

= = equals

! = does not equal

&& (and)

And and (and)

|| or (OR)

or or (or)


! No (not)

Today, let's talk about Process control tomorrow.

10 days to learn the first day of PHP

Related Article

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.