10 days learn to write PHP dynamic website

Source: Internet
Author: User
Tags php dynamic website require

10 days to learn the first day of PHP

Use Apache Web server and my SQL as Web servers and databases under the php-4.3.3 environment to do a simple build and access view database with phpMyAdmin.

Syntax for PHP:

1. Embedding Method:

PHP can be a <?php or a start symbol, the end symbol is ", of course, you can also specify."

2. Reference documents:

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 top of the PHP program, PHP program before executing, will first read into the require designated to introduce the file, so that it becomes part of the PHP Program Web page. A commonly used function can be introduced into a Web page in this way.

Include use methods such as include ("myincludefile.php");. This function is typically placed in the processing section of the Process Control. The PHP Program page reads the included file when it is read. This way, you can simplify the process of executing a program.

3, annotation method:

<?php
echo "This is the first example. n "; This example is a comment in C syntax
/* This example uses multiple lines of
Comment Mode * *
echo "This is the second example. n ";
echo "This is the third example. n "; # This example uses the UNIX Shell syntax annotation
?>

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 ("Zi", "ugly", "Yin", "Mao");

This leads to two questions: the first PHP variable begins with "$", and the second PHP statement is ";" End. These two omissions are also the most error in the procedure.

5. Operation Symbol:

Mathematical operations:

Symbolic meaning
Addition operations
-Subtraction operation
* Multiplication operation
/Division Operations
% take remainder
Accumulation
--Diminishing

String Operations:

There is only one operation symbol, the period in English is ".". It can concatenate strings into a new merged string.

?
$a = "PHP 4";
$b = "strong function";
echo $a. $b;
?>

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

Logical operations:
Symbolic meaning
< less than
> Greater than
<= less than or equal to
>= is greater than or equal to
= = equals
!= is not equal to

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.