第五、六、七講課件及代碼資料第六_php基礎(chǔ)2_W_第1頁
第五、六、七講課件及代碼資料第六_php基礎(chǔ)2_W_第2頁
第五、六、七講課件及代碼資料第六_php基礎(chǔ)2_W_第3頁
第五、六、七講課件及代碼資料第六_php基礎(chǔ)2_W_第4頁
第五、六、七講課件及代碼資料第六_php基礎(chǔ)2_W_第5頁
已閱讀5頁,還剩66頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、 1231. 1.PHP / E# / H 9 : D4 1 / F ,K3& 4 9 /LD %$.J9pRf2CY?U&f0vY ?U&f:/c ?U&f0N=Y ?J9fteY a; , 1 1 )42- 0 - 5 2- PHPNl2aAoZ(2a VM 2a;#KC.i ) 14tMb/ :2a;A6.i4t #?S *_m14tMgF6H.i unset($var)Pu%4t PHPPR : U/ : PHP 5 J :? VDJ 1 T PHPJ :$% 2 T PHPJ .% 3 T :.6 Q3, 4 T &E# .” ;.M : 0G : TJX for4FN B : !?

2、 X *_J+8# TKI PHP;, &4(O /5 .- /* (O / $ .- / GL : / 1 (O /!.- / N8 K3 # PCJ &4 /2H I 7 /E7 MF D6 M = / (O / ? PHP)*2# + + 2# ! 2# 2#- 2#1/ + 2# ( . function_exists() 3$2#% 19_functionfactoria.php 2#( ,=&0 PHP/35 & 6 & &/ & = - & 8 &$ & &0 / & (9 &/? 2 ;7:2 & =40!/$ & * & + &%/ , & $ & =/:2 ( = #- =

3、 9 &31) PHP7:# - -7 - F 1 F F &/%$I -7 +B )( - 3 6)( - - G79 -A5;1 $I -7 4, 5E8.(A57 - ?H0D *CA5$ I 20 !functionfactoria.php&/ 57E8 F. ( = ? 5E8 F.( PHP,01 # 2 # 2 + 5 3 )! # % 6 # *- , 3 + + 5,$ #, + 5 & .$( # ,% ! # 7 &”/ function fun(&$var1)#4+,% 6 # 7 &”/ function fun($var1)fun(&$var2)(1)(2) ! #

4、$var1, # * 6 #$var2, *- , PHP 3# PHP 5! # # PHP 20_functionparameter.php PHPDHI 6 L- 6C 6D%& R.B# 6 PHP 5 P5 # 6D # 7 ( C R.B/ 6DOC C D)=2 Function fun()$var=”fun”;$var(); OC$var()0E3 OC 6fun() $var() # 6 # 6 :Q 6OC8D;* 0 # 6 S $” 9 =, C9 8#4 C9PHP;* 4 ” D9 :. ” ” D9 : %6 ?5include().require() 1 92

5、C9 8# /) 2 B 7- ! ;* & 9 C ! ;* 50 ! 1 & 9 C ! 1 50 ! 1 $30 H - 9 8 (8 1 %F H % H 3? - (8 905$1 8 % H )6*91PHP 9 % H& 1 #. G + AI 9 % H ! 9B5 global$ H ; / 25_globallocalinclude.php %F H % H 1 # ( # M -L2 # M( 1 &! ) %, %, M . * ) H 4P ( $ ?php$a =1;$b =2;function Sum()$b=$a+$b;print Internal $b is

6、$b;Sum();print ;print Out $b is $b;? - # ) ( ( - ,() -$ - global - + . ) $GLOBAL, #* ! & # ( - $GLOBAL$) % ( ?php$a =1;$b =2;function Sum()global $a;global $b;$b= $a+ $b;print Internal $b is $b;Sum();print ;print Out $b is $b;? $ 5 2! ! $ 5 2! . # $ $ !* J H 8H 2 _:!( :! _:!#NH P) BZ3! % ,* 9 V XQMD

7、 _:! 0O4J _:!J2 ?G *!& static”1 PHP J :! U !J !J!& *#26: 9%.9 &*#26: 9 ?/&)$/& 3 ( . )( 2?/& $/& (& 0;2?/&=8*#275! - 9+*6#26 *#2 , 841 60h?o,n4An3C6 !766V5% !M6o.+#w!766o6: wd)o i766 w Wp o. y$wi$Ea; ( . mE B?2rI8 =l=21i*v/6: 3# * * *% 0 3 * !( 2 3$/ )for!( orderform.html .+ 1 ,+ & test.php?php$oilq

8、ty = $_POSToilqty;$tireqty = $_POSTtireqty;$sparkqty = $_POSTsparkqty;echo Your order is as follows:; echo $oilqty=.$oilqty;echo $tireqty=.$tireqty; echo $sparkqty=.$sparkqty;?TiresOilSpark Plugs ( orderform.html # ( + % $ ), & ( * ! $value) $key = $value;echo Your order is as follows:; echo $oilqty

9、=.$oilqty;echo $tireqty=.$tireqty; echo $sparkqty=.$sparkqty; $ ; $ ; 2 5 $ ; -)& $ ; )& $)& 0 + $ ; .& 1 52 / 1) 1 9 8 71)6 ;! ( 0 C+;: 4815 A ?9(4 3- A$ - A 6 0 A5 # + 5 3+ 4(4 A5.2 0 /%!= A &”7 & 27_refvar.php (4 A ?e5i!vHu=yu yu?yu? g* bC e-k Al|:rj?d;?vfg /!rn?i(h7vw1Zt MoiliiaT Huyu?Pu9zY Huyu

10、?Z th? dqlE 0)_Pn c2!Tyuvnl e !yucxu CvaOC ?1p u . ve m%vl yul_6a f yuos$pyv n 4 ,N ., 3 . , 3 3 ,. 2 * . * . * . &) %/*( ! 1 - # , , - 3 + * . $ * 0* ( , !(map* .$str = this is a test;function foo( $a, $b )$tmp = 12;return $tmp + $a + $b;function to() + = / 6? :1./ 68 - / ,name-attribute ; ! 19 #54

11、 $ , ) ,/ 6 BZ.t /d PHP Ick_ A rm !:active symbol tableK2h/d #/ ) :4 0 3 #/ 8 $ /#/+ 87 + COW + 63 * , $a = range(0,1000);var_dump(memory_get_usage(); / / 8 /! 8b$b = &$a; /a0195 2ba b( 1 9 var_dump(memory_get_usage();/$a%b.+ $a = range(0,1000); var_dump(memory_get_usage();/! 8 $a = range(0,1000); v

12、ar_dump(memory_get_usage(); / /8 /! 8b$b = $a; /-+$b $a ( 19 var_dump(memory_get_usage();/$a%b . + & 63 * $a = range(0,1000); var_dump(memory_get_usage(); -zval -%zval ! $ ! ! # .;$O-Wdzval , /!-NFICM0 L AK CM5PH PC H?: ,eg5 , b # P1_) ,*6a7 8Z ,49 , ( ,%W :sS PHP Q&%?-TLr/ bool,int,float,string (r/

13、 array, object T1 struct _zval_struct zvalue_value value; /* value */zend_uint refcount gc; /* variable ref count */ zend_uchar type; /* active type */zend_uchar is_ref gc; /* if it is a ref variable */ ; typedef struct _zval_struct zval; -zval#define IS_NULL 0#define IS_LONG 1#define IS_DOUBLE 2#de

14、fine IS_BOOL 3#define IS_ARRAY 4#define IS_OBJECT 5#define IS_STRING 6#define IS_CONSTANT 8#define IS_CONSTANT_ARRAY 9is_ref gc 0 4. 1 euXk-sbzval-xdebugb9 1, . xdebugm13dTYPHP g:o?debugb9,rC51_Ycdc/var_dump,echo,printAn_u % 2eTx=/bM:DD$ ) G6 4E #B 6# & &D = & G6 4E Ywfia$:$ + # EB gz / ! &D = f7th

15、G6 4E xdebug_debug_zval(str);str: (refcount=1, is_ref=0)=test zval ,$str=test zval;( 5% , ./ 1 # $./ str2 5& 4. 5 ) +! refcount=1 is_ref=0.zval 2. 53 0 5% zval.refcount : $str2 = $str;,- ! -zval -& & (*$ , zval item- zval 2. ,$ar )# 3 zval %+ $ar =array( id= 38,name = shine 9E% 38,name = shine);$art

16、est = $arname; ( 3-zval& 2/zval 3 1,5. ( ( 3 *4 a: (refcount=1),is_ref=0)a: (refcount=2),is_ref=1) a: (refcount=2),is_ref=1) 0,+% c1, ! #23 $ ! /2/zval3 $a = range(0,3); xdebug_debug_zval(a);/ *4) 3 - ( $c =&$a; xdebug_debug_zval(a);$c = range(0,3); xdebug_debug_zval(a); 1231. 1 2 3PHP5 4 5 6 PHP5 9

17、 ,2 0 , ! , PHP4 9 , 8 .0 ,$ .! ,$ 0 ,$ 4 , + PHP1 6# 5 ) 3 C? 7* ;! ,$ 4 , = 5) 3 /A( % &: B PHP5 . &0 + ,$( - 3/ ;extension=php_xxx.dll” 4, ;”) 1# APACHEphp.ini%php.ini*! 2 + 1.array() Array() func_array.php + 2.count() &count()&,. + * 0 % 1 !(4 + func_count.php 3.each() & Each() / + *3 + 2 ) $ #

18、-& % 1 + func_each.php & ! & $ 4 & % .# print_r ! & $ word, 3=excel, outlook, access);print_r($ms_office);? pbp $parray_chunkETh.1pblc? array array_chunk(array $input_array, int $size, bool$preserve_key);hpoa31Cp,$input_arraysif?ypb+A_pb),$sized_pbe?d,v1pb2;y 1p,$preverse_keysEmCp,J3TRUEr,?dyv1pbyam

19、9x_pbyamc-J3FALSEr,? dyv1pbyamni9x60kfyTpam*hpyje:s.1pb,k1pbyam60kf,h pbyv1;Rws.1pb,A_pbe?dy.1pb* ), ;# = 5 2?2) =? 5 5E 5 = =%$ = 2 2 5# # = 5 ( ? $ ? 2?2) % ;# = 5 /. ( , 6 6 6 ) $( ) . 6 ) ) $( ) ) Mars,5=Jupiter,6=Saturn);$planet = array_merge($arr1,$arr2);echo ; print_r($planet);? *5 *-)# / *so

20、rt *5 3(6)# ( ,0 6 &(* 0!. )# bool sort(array &$arr ,int $sort_flag);asort 9 * *5 3;7)# *51 4$ 2 9 * - *5 3(6)# + .% 9 *: TRUE : FALSE ksort 9 * *5 3(4$ Earth,Y=Venus,Z=Mars,A=Jupiter,B=Saturn);$planet1 = array( Earth, Venus,Mars, Jupiter, Saturn); trim(),ltrim(),rtrim(),chop() strlen() !5 Chop() rt

21、rim() $ Ltrim()$ Trim() $ Strlen() # Ucwords() .Ucfirst() . Strtoupper() . Strtolower() .Str_word_count() . + + # 2.strrpos() strpos() : strpos() )$ : int strpos ( string haystack, mixed needle , int offset ) 1 strrpos /* strpos() )needle 0 ( + . 2 )!3 + haystack , % &) - . ! % 5 ( / ( strstr() ( st

22、rrchr() (:Strstr()( strrchr()(90& + string strstr ( string haystack, string needle )string strrchr ( string haystack, string needle )72 A C ( B 9)( (D ( 6*3# : + 68- Strstr() (6./ ! needle $B 2 % 9 Strrchr() (/ needle $B 2 % 9 . * . $ substr_count() :substr_count() ,% :int substr_count ( string hays

23、tack, string needle , int offset , int length )+#04 . needle .haystack ),& 5 Substr_count() 7 ! 8 offsetlength - 2-3$ ,6( 9 ,! offset! 01 ! 1 4/, # # str_split() array str_split ( string string , int split_length )# + ) ! $ str_split()$ str_split() # & + string # * length(% + 6 2 * 6 * PHP 3 6 *.sub

24、str()8 Substr() *4 31% string substr ( string string, int start , int length )/ *A 6 (! :$ (!C#4 *string 6 start 4 : 0$ = B *length, *7start6$ length?*+;5 lengthstart :$ *length4 :90 GnFO C d 8 GnZUnixGn= %UNIXab UnixGn=I RP-UGn197041M1F00G00006, 8 GnSpZC $T9JXUnixGn=5g f 9)ZDC UnixGn=%9(G q3 NY 1 %0Gnke G YL HJ $ o Gnk iW M * C!c !cI28* 29* 30* 31* YC.EVB I eZ + Q YUnixGn= m %_ GnZ& /ZC : Z2I_ GnZU

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論