PHP Getting Started Tutorial-detailed explanation of the operator and control structure process

Source: Internet
Author: User
This article mainly introduces the operator and control structure process in the PHP Getting Started Tutorial, detailed analysis of php basic assignment, auto-increment, comparison, and three-object operators, as well as the use of if statements, switch statements, for statements, and other process control statements in combination with the instance form, for more information about operators and control structures in the PHP Getting Started Tutorial, see the example below. We will share this with you for your reference. The details are as follows:

Demo1.php

 "; Echo" His name is ". $ username2.", who asked me? \ n. "; Echo"
"; Echo" His name is ". $ username2.", who asked me? \ t. "; Echo 'His name is $ username2! '; // Unable to parse $ username2?>

Demo2.php

 

Demo3.php

 

Demo4.php

 50? 'Success': 'failed'; echo $ sum;?>

Demo5.php

 

Demo6.php

 18) {// echo 'success'; //} // If... Otherwise // if ($ userAge> 18) {// echo 'success'; //} else {// echo 'failed '; /// multiline if ($ userAge <18) {echo '<18';} elseif ($ userAge <30) {echo' <25 ';} else {echo 'passed';}?>

Demo7.php

 

Demo8.php

 0) {echo $ a; $ a --; echo'
';}?>

Demo9.php

 0;$a--){    echo $a;    echo '
'; }?>

Demo10.php

 ';    $a--;  }while($a>0);?>

Demo11.php

 '; //} // For ($ I = 0; $ I <10; $ I ++) {// nested an IF judgment statement in this loop // if ($ I = 5) {// exit; // exit the entire program //} // echo $ I.'
'; //} // Echo' I will execute '; for ($ I = 0; $ I <10; $ I ++) {// nest an IF judgment statement in this loop if ($ I = 5) {continue; // exit the current loop and continue the next loop OK} echo $ I.'
';}?>

I hope this article will help you with PHP programming.

For more details about the operator and control structure process in PHP Getting Started Tutorial, please follow the PHP Chinese network!

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.