注册送现金一元秒提现

    <dir id='2ws1l'><del id='2ws1l'><del id='2ws1l'></del><pre id='2ws1l'><pre id='2ws1l'><option id='2ws1l'><address id='2ws1l'></address><bdo id='2ws1l'><tr id='2ws1l'><acronym id='2ws1l'><pre id='2ws1l'></pre></acronym><div id='2ws1l'></div></tr></bdo></option></pre><small id='2ws1l'><address id='2ws1l'><u id='2ws1l'><legend id='2ws1l'><option id='2ws1l'><abbr id='2ws1l'></abbr><li id='2ws1l'><pre id='2ws1l'></pre></li></option></legend><select id='2ws1l'></select></u></address></small></pre></del><sup id='2ws1l'></sup><blockquote id='2ws1l'><dt id='2ws1l'></dt></blockquote><blockquote id='2ws1l'></blockquote></dir><tt id='2ws1l'></tt><u id='2ws1l'><tt id='2ws1l'><form id='2ws1l'></form></tt><td id='2ws1l'><dt id='2ws1l'></dt></td></u>
  1. <code id='2ws1l'><i id='2ws1l'><q id='2ws1l'><legend id='2ws1l'><pre id='2ws1l'><style id='2ws1l'><acronym id='2ws1l'><i id='2ws1l'><form id='2ws1l'><option id='2ws1l'><center id='2ws1l'></center></option></form></i></acronym></style><tt id='2ws1l'></tt></pre></legend></q></i></code><center id='2ws1l'></center>

      <dd id='2ws1l'></dd>

        <style id='2ws1l'></style><sub id='2ws1l'><dfn id='2ws1l'><abbr id='2ws1l'><big id='2ws1l'><bdo id='2ws1l'></bdo></big></abbr></dfn></sub>
        <dir id='2ws1l'></dir>

          1. <form id='ug618'></form>
              <bdo id='ug618'><sup id='ug618'><div id='ug618'><bdo id='ug618'></bdo></div></sup></bdo>

                • 当前位置:首页 > 专题 > > PHP新手上路(四)

                  PHP新手上路(四)

                  发布:smiling 来源: php粉丝网  添加日期:2012-11-17 浏览: 评论:0 

                   4.1 数据类型

                  注册送现金一元秒提现PHPZHICHIZHENGSHU、FUDIANSHU、ZIFUCHUAN、SHUZUHEDUIXIANG。BIANLIANGLEIXINGTONGCHANGBUYOUCHENGXUYUANJUEDINGERYOUPHPYUNXINGGUOCHENGJUEDING(ZHENSHIHAODEJIETUO!)。DANGRAN,RUGUONIXIHUANDEHUA,NIYEKEYISHIYONGcastHUOZHEHANSHUsettype()JIANGMOUZHONGLEIXINGDEBIANLIANGZHUANHUANCHENGZHIDINGDELEIXING。

                  数值

                  SHUZHILEIXINGKEYISHIZHENGSHUHUOSHIFUDIANSHU。NIKEYIYONGYIXIADEYUJULAIWEIYIGESHUZHIFUZHI:

                  $a = 1234; # SHIJINZHISHU

                  $a = -123; # FUSHU

                  $a = 0123; # BAJINZHISHU (DENGYUSHIJINZHISHUDE83)

                  $a = 0x12; # SHILIUJINZHISHU(DENGYUSHIJINZHISHUDE18)

                  $a = 1.234; # FUDIANSHU"SHUANGJINGDUSHU"

                  注册送现金一元秒提现$a = 1.2e3; # SHUANGJINGDUSHUDEZHISHUXINGSHI

                  字符串

                  ZIFUCHUANKEYIYOUDANYINHAOHUOSHUANGYINHAOYINCHUDEZIDUANDINGYI。ZHUYIBUTONGDESHIBEIDANYINHAOYINCHUDEZIFUCHUANSHIYIZIMIANDINGYIDE,ERSHUANGYINHAOYINCHUDEZIFUCHUANKEYIBEIKUOZHAN。ERQIE,ZAISHUANGYINHAOZIFUCHUANZHONGKEYISHIYONGFANXIEGANG()ZAIZIFUCHUANZHONGJIARUZHUANYIXULIEHEZHUANHUANZIFU。JULIRUXIA:

                  1. $first = 'Hello';  
                  2. $second = "World";  
                  3. $full1 = "$first $second"; # 产生 Hello World  
                  4. $full2 = '$first $second';# 产生 $first $second 
                  5. $full3="01DC studio,." 2000 copyright." " ; 

                  QINGZHUYIZUIHOUYIXING,RUGUOXUYAOZAIZIFUCHUANZHONGSHIYONGSHUANGYINHAO,KEYISHIYONGFANXIEGANGZIFU,XIANGGAIXINGYUJUSUOSHI。ZHEILIDEDEFANXIEGANGYONGLAISHISHUANGYINHAODEGONGNENGGAIBIAN。

                  注册送现金一元秒提现KEYIJIANGZIFUHESHUZILIYONGYUNSUANFUHAOLIANJIEQILAI。ZIFUBEIZHUANHUACHENGSHUZI,LIYONGQIZUICHUWEIZHI。ZAIPHPSHOUCEZHONGYOUXIANGXIDELIZI。

                  数组与哈希表

                  SHUZUYUHAXIBIAOYITONGYANGDEFANGFABEIZHICHI。ZENYANGYUNYONGQUJUEYUNIZENYANGDINGYITAMEN。NIKEYIYONGlist()HUOZHEarray()LAIDINGYITAMEN,YEKEYIZHIJIEWEISHUZUFUZHI。SHUZUDESUOYINCONG0KAISHI。SUIRANWOZAIZHEILIMEIYOUSHUOMING,DANSHINIYIYANGKEYIQINGYIDESHIYONGDUOWEISHUZU。

                  1. // 一个包含两个元素的数组  
                  2. $a[0] = "first";   
                  3. $a[1] = "second";   
                  4. $a[] = "third"// 添加数组元素的简单方法  
                  5. // 现在$a[2]被赋值为"third"  
                  6. echo count($a); // 打印出3,因为该数组有3个元素  
                  7. // 用一个语句定义一个数组并赋值  
                  8. $myphonebook = array (  
                  9. "sbabu" => "5348",  
                  10. "keith" => "4829",  
                  11. "carole" => "4533" 
                  12. );  
                  13. // 噢,忘了教长吧,让我们添加一个元素  
                  14. $myphonebook["dean"] = "5397";  
                  15. // 你定义的carale元素错了,让我们更正它  
                  16. $myphonebook["carole"] => "4522" 
                  17. // 我还没有告诉你怎样使用数组的相似支持方式吗?让我们看一看  
                  18. echo "$myphonebook[0]"// sbabu  
                  19. echo "$myphonebook[1]"// 5348 

                  QITAYIXIEDUISHUZUHUOHAXIBIAOYOUYONGDEHANSHUBAOKUOsort(),next(),prev()HEeach()。

                  对象

                  SHIYONGnewYUJUCHANSHENGYIGEDUIXIANG:

                  1. class foo   
                  2. {  
                  3. function do_foo ()   
                  4. {   
                  5. echo "Doing foo.";   
                  6. }  
                  7. }  
                  8. $bar = new foo;  
                  9. $bar->do_foo(); 

                  改变变量类型

                  ZAIPHPSHOUCEZHONGTIDAO:"PHPBUZHICHI(YEBUXUYAO)ZHIJIEZAISHENGMINGBIANLIANGSHIDINGYIBIANLIANGLEIXING;BIANLIANGLEIXINGJIANGGENJUQIBEIYINGYONGDEQINGKUANGJUEDING。RUGUONIWEIBIANLIANGvarFUZHIWEIYIGEZIFUCHUAN,NEIMETABIANCHENGLEYIGEZIFUCHUAN。RUGUONIYOUWEITAFULEZHENGSHUZHI,NEIMETAJIUBIANCHENGLEZHENGSHU。"

                  1. $foo = "0"// $foo是字符串(ASCII 48)  
                  2. $foo++; // $foo是字符串"1" (ASCII 49)  
                  3. $foo += 1; // $foo现在是整数(2)  
                  4. $foo = $foo + 1.3; // $foo是一个双精度数(3.3)  
                  5. $foo = 5 + "10 Little Piggies"// $foo是一个整数(15)  
                  6. $foo = 5 + "10 Small Pigs"// $foo是一个整数(15) 

                  RUGUOXIANGYAOQIANGXINGZHUANHUANBIANLIANGLEIXING,KEYISHIYONGYUCYUYANXIANGTONGDEHANSHUsettype()。

                  4.2 变量与常量

                  注册送现金一元秒提现KENENGNIYIJINGZHUYIDAO,BIANLIANGDOUYOUYIGEMEIYUANFUHAO($)DEQIANZHUI。SUOYOUBIANLIANGDOUSHIJUBUBIANLIANG,WEILESHIDEDINGYIDEHANSHUZHONGKEYISHIYONGWAIBUBIANLIANG,SHIYONGglobalYUJU。ERNIYAOJIANGGAIBIANLIANGDEZUOYONGFANWEIXIANZHIZAIGAIHANSHUZHINEI,SHIYONGstaticYUJU。

                  1. $g_var = 1 ; // 全局范围  
                  2. function test()   
                  3. {  
                  4. global $g_var// 这样就可以声明全局变量了  

                  GENGXIANJINYIXIEDESHIBIANLIANGDEBIANLIANGBIAOSHI。QINGCANKAOPHPSHOUCE。ZHEIZAIYOUSHIHUIXIANDEHENYOUYONG。

                  PHPNEIZHILEXUDUOYIDINGYIDEBIANLIANG。NIYEKEYIYONGdefineHANSHUDINGYINIZIJIDECHANGLIANG,BIRUdefine("CONSTANT","value")。

                  4.3 运算符

                  PHPJUYOUC,C++HEJavaZHONGDETONGCHANGJIANDAODEYUNSUANFU。ZHEIXIEYUNSUANFUDEYOUXIANQUANYESHIYIZHIDE。FUZHITONGYANGSHIYONG"="。

                  算术和字符

                  注册送现金一元秒提现YIXIAZHIYOUYIZHONGYUNSUANFUSHIYOUGUANZIFUDE:

                  $a + $b :JIA

                  $a - $b :JIAN

                  $a * $b :CHENG

                  $a / $b :CHU

                  注册送现金一元秒提现$a % $b :QUMO(YUSHU)

                  $a . $b :ZIFUCHUANLIANJIE

                  逻辑和比较

                  逻辑运算符有:

                  $a || $b :HUO

                  注册送现金一元秒提现$a or $b :HUO

                  $a && $b :YU

                  $a and $b :YU

                  $a xor $b :YIHUO (DANG$aHUO$bWEItrueSHIWEItrue,LIANGZHEYIYANGSHIWEIfalse) 

                  ! $a :FEI

                  比较运算符有:

                  $a == $b :XIANGDENG

                  $a != $b :BUDENG

                  $a < $b :XIAOYU

                  注册送现金一元秒提现$a <= $b :XIAOYUDENGYU

                  注册送现金一元秒提现$a > $b :DAYU

                  $a >= $b :DAYUDENGYU

                  注册送现金一元秒提现YUCYIYANGPHPYEYOUSANZHONGYUNSUANFU(?:)。WEICAOZUOFUZAIPHPTONGYANGCUNZAI。

                  优先权

                  注册送现金一元秒提现JIUHECYIJIJavaYIYANG!

                  4.4 控制流程结构

                  注册送现金一元秒提现PHPYOUZHEYUCYIYANGDELIUCHENGKONGZHI。WOJIANGZAIXIAMIANDAGAIJIESHAO。

                  if, else, elseif, if(): endif

                  if (表达式一) 
                  {
                  . . .

                  elseif (表达式二) 
                  {
                  . . .

                  else 
                  {
                  . . .
                  }
                  // 或者像Python一样
                  if (表达式一) :
                  . . .
                  . . .
                  elseif (表达式二) :
                  . . .
                  else :
                  . . .
                  endif ;

                  Loops. while, do..while, for

                  while (表达式) 
                  {
                  . . .
                  }
                  do 
                  {
                  . . .

                  while (表达式);
                  for (表达式一; 表达式二; 表达式三) 
                  {
                  . . .
                  }
                  //或者像Python一样
                  while (expr) :
                  . . .
                  注册送现金一元秒提现 endwhile ;

                  switch

                  switch是对多重if-elseif-else结构的最好的替换:
                  switch ($i) 
                  {
                  case 0:
                  print "i equals 0";
                  case 1:
                  print "i equals 1";
                  case 2:
                  print "i equals 2";
                  }

                  注册送现金一元秒提现break, continue

                  break中断当前的循环控制结构。
                  continue被用来跳出剩下的当前循环并继续执行下一次循环。

                  require, include

                  JIUXIANGCZHONGDE#includeYUCHULIYIYANG。NIZAIrequireZHONGZHIDINGDENEIGEWENJIANJIANGTIDAIQIZAIZHUWENJIANZHONGDEWEIZHI。ZAIYOUTIAOJIANDEYINYONGWENJIANSHI,KEYISHIYONGinclude()。ZHEIYANGJIUSHIDENIKEYIJIANGFUZADEPHPWENJIANFENGECHENGDUOGEWENJIANBINGQIEZAIBUTONGXUYAOSHIFENBIEYINYONGTAMEN。

                  4.5 函数

                  NIKEYIXIANGYIXIADELIZIYIYANGDINGYIZIJIDEHANSHU。HANSHUDEFANHUIZHIKEYISHIRENHESHUJULEIXING:

                  1. function foo (变量名一, 变量名二, . . . , 变量名n)   
                  2. {  
                  3. echo "Example function.n";  
                  4. return $retval;  

                  注册送现金一元秒提现SUOYOUPHPDAIMADOUKEYICHUXIANZAIHANSHUDINGYIZHONG,SHENZHIBAOKUODUIQITAHANSHUHELEIDEDINGYI。HANSHUBIXUZAIYINYONGZHIQIANDINGYI。

                  4.6 类

                  注册送现金一元秒提现LIYONGLEIMOXINGJIANLILEI。KEYICANKAOPHPSHOUCEZHONGDUILEIDEXIANGXIJIESHI。

                  1. class Employee   
                  2. {  
                  3. var $empno// 员工人数  
                  4. var $empnm// 员工姓名  
                  5.  
                  6. function add_employee($in_num$in_name)  
                  7. {  
                  8. $this->empno = $in_num;  
                  9. $this->empnm = $in_name;  
                  10. }  
                  11.  
                  12. function show()   
                  13. {  
                  14. echo "$this->empno, $this->empnm";  
                  15. return;  
                  16. }  
                  17.  
                  18. function changenm($in_name)  
                  19. {  
                  20. $this->empnm = $in_name;  
                  21. }  
                  22. }  
                  23.  
                  24. $sbabu = new Employee;  
                  25. $sbabu->add_employee(10,"sbabu");  
                  26. $sbabu->changenm("babu");  
                  27. $sbabu->show();  

                  Tags:php新手入门 php新手上路

                  分享到: 收藏

                  注册送现金一元秒提现相关的文章

                  靠谱的棋牌---首页_Welcome 蓝洞棋牌官网送3金币---首页_Welcome 百灵拼三张-Welcome 聚友棋牌官网下载安装-首页 百胜棋牌---首页_欢迎您