Blogger Information
Blog 17
fans 0
comment 0
visits 10691
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php变量作用域&程序流程之分支结构_2018-08-24_9:00提交
斯达融的博客
Original
571 people have browsed it

一、知识点:1、变量及作用域;2、变量类型;3、分支结构。

二、作业:

1、手抄:作么是变量的作用域?

b.jpg


2、代码作业:

实例

<?php
echo "<h3>编程: 变量的类型与检测</h3><hr />" ;
$myname='staroom';//全局

function display(){
  $job='php爱好者';//局部
  static $count=0; //静态
  $count++;
  return "<p>第{$count}次声明:".$GLOBALS['myname'].'是'.$job."</p>";
}

//检测
echo display() ;
echo display() ;
echo display() ;

echo "<hr />";
echo "<h3>编程: 分支结构的实例</h3><hr />" ;
$a=0;
 echo   $a++%2?"<p>count是偶数</p>":"<p>count是奇数</p>";
 echo   $a++%2?"<p>count是偶数</p>":"<p>count是奇数</p>";

运行实例 »

点击 "运行实例" 按钮查看在线实例

3、运行结果:

a.png


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post