????? ??? ??, ??? ?? ???? PHP - PowerPoint PPT Presentation

About This Presentation
Title:

????? ??? ??, ??? ?? ???? PHP

Description:

??? ???????? ?????? ??? ?????, ?? ??? ????? ???????? 2003-2005 ... ar[ 0']= polka dots'; echo $ar[0]; //prints polka dots $ar[0]= something' ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 24
Provided by: asafp
Category:
Tags: php | polka

less

Transcript and Presenter's Notes

Title: ????? ??? ??, ??? ?? ???? PHP


1
????? ??? ??, ??? ?????? PHP ????? ??' 9
  • ??????
  • ??? ????
  • ????? ???? ???? ????? ??????
  • ?????? ????-?????? ???????
  • ?????? ??-??????
  • ?????? ?? ??????

2
??? ????
  • ?????? ?? ????? ?????? ???????? ????? ???? ?????.
    ???? ?? ??? ???? ?"??".
  • ?? ???? ????? ???? ??????? ??? (?????? ????? ???
    ?????), ??????? (????? ?? ???).

countries
??????
???
3
???? ????
  • ?PHP, 0 ??? ???? ????, ???? ???????, ?????? ????,
    ?? "?????? 0, ????? ??? ?????? ????? ?? ??????
    0.
  • ????? ???? ????? ?????? ?"? ????
  • varindex

countries
??????
???
4
????? ????
  • ?????? ??????? ??????, ?????? ?? ????? ????
    ?????? ???. ???? ????? ???? ????? ????? array (
    ), ????????? ???????? ?? ?????? ?????????
    ???????? ??
  • countries array (ca, cr, de)

countries
?? ??? ??????? ??? ????? ????? ????????, ?????
???? countries array(). ????? ?? ???
???????, ?? ????? ??? ????? ????.
5
????? ????
  • ???? ?? ????? ?? ??????? ????? ????? ?????? ??
    ????????? ???? ????, ?? ???? ??? ????? ?? ???????
    ??????
  • countries array (1gtcr, 3gtuk, us)

countries
6
????? ????
  • ?????? ????? ????? ?????, ?????
  • countries ca
  • ?????? ??"? ?????? ????? ?? ???? ca ??? ??????
  • ???? ?? ??? ?????. ????? ??, index 0.

???? ???? ?????? ??? ????? ?????? ????!
countries
???? ??????? ????? ????? ????? ?? ?????
7
????? ????
  • ???? ???? ????? ?? ??? ???? ????? ?????? ?? ????.
  • countries 3uk

countries
8
????? ????
  • ??? ?? ?????
  • countries us
  • ?????? ???? ????? ??????? ???? ??????? ?????
    ????? ????? ?? ?????.

countries
9
???? ?? ???? ????
  • ???? ???? ?? ???? ("????? 0" - ??? ????????
    ??????), ?????
  • countries array (cr, de, us)
  • num_elements count (countries)
  • for (idx0 idx lt num_elements idx)
  • // ???? ?? ??? ????? ?????
  • echo countries idx ."ltbr /gt\n

???????? count ( ) ???? ?? ???? ?????? ?????
10
???? ?? ???? ????
  • ????? ????? - ???? ?????
  • ???? ??? ??? ?????? ????, ?????? ???? ?? ?????
    ??? ????? ??????,
  • ????? ?????? "???? ?????"

// bubble sort for ar for(icount(ar)-1ilt0
i--) for(j0jltij)
if(arjgtarj1)
ezerarj
arjarj1
arj1ezer //if
//for j
???? ????? ?????? ????? ??, ??? ?????? ???????
?????? ??????? ?????? ?????.
11
???? ?? ???? ????
  • ???? ?? ????????? print_r, ?????? ?? ??????
    ?????? ????? ?? ???? ????

lt?php ararray(1,2,dimka,7) ar6true ar
my_indexxyz print_r(ar) artrue ?gt
???????? ?? ????? ???? ??????? ?? ?? ?????
??????? ????????, ????????, ??????.
12
?????? ???? ?????? ???????
  • ?? ??, ??? ??????? ?????? ??????? ??? ?????
    ?????, ?? ?PHP ?? ?????? ???????? ???? ??
    ???????, ????? string. ????? ???? ?????? ?? ??
    ??????? ??????? ?? ???? ????.
  • countries ca Canada
  • countries cr Costa Rica
  • countries de Germany
  • countries uk United Kingdom
  • countries us United States

13
?????? ???? ?????? ???????
  • ?? ????? ????
  • countries array ( ca gt Canada, cr
    gtCosta Rica,de gt Germany,ukgtUnited
    Kingdom, usgtUnited States)

14
?????? ???? ?????? ???????
  • ???? ?????
  • ??? ????? ??????? ???????, ???? ???? ??? 1,
    ?????? ???? ???? 1
  • ?????? ??????. ????, ???? ?? ???? ????? ?????????
    ?? ??????(!)

lt?php ararray() ar02 ar0polka
dots echo ar0 //prints polka
dots ar0something echo ar0 //prints
something ?gt
??? ???? ???? ??? ?????? ????? ???????? ?????????
????????? ??????? ?'?????' ???? ???. ?? ?????
?????? ????????? ???? 1,2,22000, ??? ??
???? ????? 1,2,22000. ????? ???? ???? ?? ?????
????? "???????".
15
?????? ???? ?????? ???????
  • ????? foreach
  • ????? ?? ?? ?????? ?? ?????? ????? ???? ????? ?"?
    ????? for
  • ?????. ???? ?????? ???? ?? ?????? ???? ??????
    ????????
  • ????? ?????? ???? ?????? ?? ??? ??, foreach.
  • ????? ??????
  • foreach(ar as idxgtvalue)
  • //statements
  • ?????? ????? ?? ????? ar, ???????? ?????? ???
    ??????,
  • ??????? ?-idx, ??? ??? ??????(?? ???? ?? ???????
    ??
  • ?????????), ??????? ?? ??? ????? ??????? ??"?,
    ???? ??????
  • value.

16
?????? ???? ?????? ???????
  • ????? foreach
  • ?????

ararray(firstgtTV,secondgtkeyboard,thi
rdgt5shekels) print_r(ar) echo lthr /gtltbr
/gt foreach(ar as indexgtmyval)
echo myval. is in index num .index .ltbr
/gt\n arindexloser echo
lthr /gt print_r(ar) echo ltbr /gt
17
?????? ???? ?????? ???????
  • ????? foreach
  • ?????? ?? ?????

18
?????? ???? ?????? ???????
  • ????? foreach
  • ???? ????? ?? ?? ???? ????? ?????? ?foreach ??
    ????? ???????
  • ???? ????? ?????? ?? ??????
  • ?????? ??????? ??????? ????? ???? ????? ????? ??
    ????
  • ????? ????? ??????(????? ??? ??? ????? ????? ???).

ararray(firstgtTV,secondgtkeyboard,thi
rdgt5shekels) foreach(ar as myval)
echo myval. is next in line ltbr /gt\n
19
?????? ?? ???????
  • ???? ?????? ?????? ?? ???????
  • for (i0 ilt4 i)
  • for (j0 jlt5j)
  • ar i j i

???? ????? ?????(???? ???? ?????? ????? 2 ??????
????? ????), ????
0 0 0 0 0
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
???? ?? ???? ?????????!!!????-?????. ?????-???.
20
?????? ?? ???????
  • ?? ????? ?? ????? ????? ????? print_r, ????

21
?????? ?? ???????
  • ????? ???? ????? ???? ?????? ???? ?? ?????
  • for (i0 ilt4i)
  • for (j0 jlt5 j)
  • for (t0 tlt20 t)
  • for (p20 pgt-7 p--)
  • arijtpit-p
    j
  • ???'...
  • ???? ?? ???? ??????? ????? ??? ???? ??????
    ??????(??? ?? ??????
  • ?????? ???? ??????). ?? ????? ?????? ?????? ????
    ?????? ????,
  • ??? ???? ????, ??? ????? ??, ??? ????? ?? ?????.

22
?????? ?? ??????
  • ????? ??????? ??? ???? ???? ???? ?????? ?? ?????
    ?????. ????, ?? ?? ????? ??"? ???? ????? ????
    ???? ????. ??????

// inner arrays in_ararray(1,2,3) in_ar2arra
y(moshe,danny,yossi) ararray(in_ar,in_a
r2) print_r(ar)
23
?????? ?? ??????
  • ???? ????? ?-?????? ?? ?????? ??????? ?? ???????
    ?? ???? ????. ????? ??? ???? ??? ?????(????????
    ????????????) ???? ????? ????? ?? ?????
  • for(i0ilt10i)
  • for(j0jlt10j)
  • arijj-i
  • ?????? ????? ?? ??????
  • ar1array(dog,cat,sheep)
  • ar2array(9,20,78,-200.6)
  • ararray(ar1,ar2)
Write a Comment
User Comments (0)
About PowerShow.com