PHP Tutorial 3rd days

Source: Internet
Author: User
For php courses written by hackers, it is recommended that you learn php. in the future, this course will be followed by php courses written by hackers. it is recommended that you learn php, which will be indispensable in the future.

Today, I got to the next level... first write one: (numbers are added)

 \ N "; // here the result is 12, which roughly means that $ a is equal to 10, and then adds 2 to the left (that is, $ ), so it's 12.?>

In my opinion, php statements focus on the concept of line. Whatever $ a represents, it generally means connecting to the right. "connecting to" or "adding" or "reducing ,! It is not just a combination of numbers. Other methods are also supported.
Write another one: (right to left)

 
 

Why is the result displayed like this? If you listen carefully every time, the previous section will say that the program runs from top to bottom and from right to left.
Write another one: (division)

 

Expected result 141608156132 is displayed. the calculation speed is really fast ......
Next step:
1. bitwise operations (this is rarely used)
& Represents and (and)
| Represents or (or)
^ Indicates mutual exclusion (Xor)
<Want to shift left
> Shift to the right
~ Take the secondary number of 1
2. logical operations (conditions, etc)
<Represents less
> Greater
<= Less than or equal
> = Greater than or equal
= (Generally, check whether a user's login is equal to or not)
! = Not equal
& And (and)
| Or (or)
Xor)
! No (Not)
Other symbols
3. Other operations
$ Variable (used many times)
& Variable indicators (before a variable)
@ Do not display the error message (before the function)
Example

 
 \ N ";?>

-> Object methods or attributes
=> Array element value
? : Triplicate operator
Remember the above, (but it is not that easy to remember, huh, huh !)
Next we will introduce the higher level, which is also the key to writing programs!
1. if (judgement) of a single row)
If... else...
If... what is... how is the result... is responsible... how...
If you are fat... you are a pig... otherwise... you are a thin monkey.
If (conditon) {statment1} true
Else {statment2} false
Example:

 5) // no extra points are required here. Note! {Echo "Yes! A> 5 \ n ";} else // no extra points are required here. Note! {Echo "error! A <5 \ n ";}?>

2. multi-row else if
Example:

 
 5) // no extra points are required here. Note! {Echo "a> 5 \ n";} else if ($ a> 3) {echo "a> 3 \ n ";} else {echo "a <5 \ n" ;}?>

3. method omitted

 
  5 ? $str = "a > 5" : $str = "a < 5" : $str = "a = 5";  echo $str; ?>

While loop (note English: bad even) although
1. while (condition1 condition)
{Statement1
Statement2
If (condition2 condition)
Break
Statement3
}

1. terminate the break and break the rules.
2. continue to run after 1 row of continue is stopped.
3. exit () is not necessarily used here.
Do... while at least once
Do
{
Staement1
Bytes
Staement2
}
While (condition)
If the condition is true, the program in do is returned.
Example
Do
{
Echo $ w ."
";
$ W ++;
}
While ($ w <10)
?>
FOR loop
Example
For ($ o =; $ o <100; $ o ++) // no extra points at the end.
{
Echo $ o ."
\ N ";
}
?>
Foreach array (array)

 
 "Good Guys", "2" => "bad guys"); // stands for "xxx1" => "Good Guys",?>

I want to learn this first, and I will study it again tomorrow... The first is a bit dizzy...

      Bad Wolf learning php 3rd days   
         
 \ N "; // here the result is 12, which means that $ a is equal to 10, and then 2 is added to the left (that is, $ a), so it is 12. /* no matter what $ a represents, it generally means to the right to the left. "Connect to" or "add" or "reduce", etc. */$ B = "Bad Wolf"; // You must remember several key points !; You need to write a semicolon. you 'd better add. $ B. = "! "; $ B. =" good guy! "; Echo $ B." haha! \ N ";?>

\ N ";?>


5) // no extra points are required here. Note! {Echo "Yes! A> 5 \ n ";} else // no extra points are required here. Note! {Echo "error! A <5 \ n ";}?>


5) // no extra points are required here. Note! {Echo "a> 5 \ n";} else if ($ a> 3) {echo "a> 3 \ n ";} else {echo "a <5 \ n" ;}?>


5? $ Str = "a> 5": $ str = "a <5"; echo $ str;?>


"; $ P ++; if ($ p = 15) break; // terminate here to break this rule.}?>


";}?>


"; $ W ++;} while ($ w <20)?>





\ N ";}?>

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.