Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Webmaster Zone > Web Development
Register

Reply
 
LinkBack Thread Tools
Old 06.11.2002, 19:39   #1
Guest
 
Posts: n/a
Downloads:
Uploads:
Post PHP Regular expressions... How-to?

Как можно ограничить количество текста в переменной, допустим до 150 слов, принемая, как разделитель, допустим, пробел.
Сори за непрофессионально-оформленный вопрос.
10х!
Reply With Quote
Old 06.11.2002, 19:46   #2
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 0
Post

count(explode($separator,$string))
Reply With Quote
Old 06.11.2002, 20:31   #3
Guest
 
Posts: n/a
Downloads:
Uploads:
Post

Ok, no mne ne poschitat' nado bylo, a v ostavit' text, urezav lishnuyu polovinu.
Reply With Quote
Old 06.11.2002, 21:28   #4
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 0
Post

$string=implode($separator,array_slice(explode($separator,$string),0,$limit))
Reply With Quote
Old 07.11.2002, 19:26   #5
Guest
 
Posts: n/a
Downloads:
Uploads:
Post

Good!
tol'ko skazhi please, zachem etot
Code:
($separator,$string),0,$limit))
                    ^^^
nolik
hotya vse rabotaet, prosto interesno
Reply With Quote
Old 07.11.2002, 21:36   #6
»
 
z0mbie's Avatar
 
Join Date: 01 2002
Posts: 777
Downloads: 1
Uploads: 0
Reputation: 0 | 0
Post

Quote:
Originally posted by stealth:
Good!
tol'ko skazhi please, zachem etot
Code:
($separator,$string),0,$limit))
                    ^^^
nolik
hotya vse rabotaet, prosto interesno
array_slice voozvrashaet vse elementы(slova) nachinaya s 0(t.e. pervogo) do $limit-a
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 04:01.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.