ѧ php ҵ駹ҹ
ѧҡ觹֡ҿѧ ѧ蹹֧ҹҡ ͨѭҷͧ
֡֡͡ ͧԴ˹ѧ͡ Ҩпѧ蹹

ѧ蹷ٴ֧ substr_count()
繿ѧ蹷Ѻӹǹ㹢ͤ շ

Ը
$text='Thisisatest';
echo
strlen($text);//14

echosubstr_count($text,'is');//2

//thestringisreducedto'sisatest',soitprints1
echosubstr_count($text,'is',3);

//thetextisreducedto'si',soitprints0
echosubstr_count($text,'is',3,3);

//generatesawarningbecause5+10>14
echosubstr_count($text,'is',5,10);


//printsonly1,becauseitdoesn'tcountoverlappedsubstrings
$text2='gcdgcdgcd';
echo
substr_count($text2,'gcdgcd');
?>



Create Date : 11 ¹ 2555
Last Update : 11 ¹ 2555 11:50:38 .
Counter : 416 Pageviews.

0 comments
: * blog comment ੾Ҫԡ
Comment :
 *ǹ comment ö javascript style sheet
 

Ҫ·ͧ
Location :
  

[ Profile ]
ԻҢͧ Blog [?]
 ҡͤѧ
 Rss Feed
 Smember
 Դ͡ : 1 [?]



Group Blog
¹ 2555

1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
 
11 ¹ 2555