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!