PHP Basic Tutorial 1 PHP Language Foundation php0 basic PHP Base Real

Source: Internet
Author: User
What is a PHP file?

PHP files can contain text, HTML, CSS, and PHP code
The PHP code executes on the server, and the result is returned in plain text to the browser
The suffix of the PHP file is ". php"

What can PHP do?

PHP can generate dynamic page content
PHP can create, open, read, write, delete, and close files on the server
PHP can receive form data
PHP can send and retrieve cookies
PHP can add, delete, and modify data in a database
PHP can restrict access to certain pages in the site
PHP is capable of encrypting data
With PHP, you can not be limited to outputting HTML only. You can also export images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.

PHP supports three types of annotations:

<html><body>
    
     // 这是单行注释# 这也是单行注释/*这是多行注释块它横跨了多行*/?>
    
     body>
   
    html>

PHP Case Sensitive

In PHP, all user-defined functions, classes, and keywords (such as if, else, Echo, and so on) are not case sensitive.
In the example below, all three echo statements are legal (equivalent):
Instance

<html><body>
    
     ECHO"Hello World!
";echo"Hello World!
";EcHo"Hello World!
";?> body> html>

Hello world!
Hello world!
Hello world!

In PHP, however, all variables are case-sensitive.
In the example below, only the first statement will show color variable value ( This is due to Color CoLoR to and CoLOR is treated as three different variables):
Instance

<html><body>
     
      $color="red";echo"My car is " . $color . "
";echo"My house is " . $COLOR . "
";echo"My boat is " . $coLOR . "
";?> body> html>

My car is red
My House is
My Boat is

PHP 5 echo and Print statements

PHP Echo and Print statements

The difference between Echo and print:
echo-capable of outputting more than one string
Print-only one string is output and always returns 1
Tip: Echo is slightly faster than print because it does not return any values.

The

PHP Echo Statement
Echo is a language structure that can be used with or without parentheses: Echo or Echo ().

     <  html ;   <  Body ;   !--? php   echo   "PHP is fun! ";  Echo   "Hello world! 
"; Echo "I plan to learn php!
"; Echo "This phrase" , "by" , "multiple" , "" string "," "threaded. "; $txt 1 = "Learn PHP" ; $txt 2 = "W3School.com.cn" ; $cars = array ( "Volvo" , "BMW" , "SAAB" ); Echo $txt 1 ; Echo "
" ; Echo "Study PHP at $txt 2" ; Echo "
" ; Echo My Car is a {$cars [0]} "; ? !-- body ; !-- html ;

Hello world!
I plan to study php!
This passage is made up of strings.
Learn PHP
Study PHP at W3School.com.cn
My car is a Volvo

PHP Print Statement
Print is also a language structure and can be used with or without parentheses: print or print ().

<html><body>
     
      print"

PHP is fun!

";print"Hello world!
";print"I'm about to learn PHP!";$txt1="Learn PHP";$txt2="W3School.com.cn";$cars=array("Volvo","BMW","SAAB");print$txt1;print"
";print"Study PHP at $txt2";print"
";print"My car is a {$cars[0]}"?> body> html>

PHP is fun!

Hello world!
I ' m about to learn php!
Learn PHP
Study PHP at W3School.com.cn
My car is a Volvo

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above introduces PHP Basic tutorial 1, including PHP, the basic aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.