preg_match quastion

This is a discussion on preg_match quastion within the PHP Language forums, part of the PHP Programming Forums category; Hi All, wondering if someone could help me with this. I have a variable $var="blh blh blah bldd ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-06-2006
kirill_uk@hotmail.com
 
Posts: n/a
Default preg_match quastion

Hi All, wondering if someone could help me with this.
I have a variable $var="blh blh blah bldd erter etert";
i need to get first three words from it so basically i have to
,somehow, count first three spaces and get "blh blh blah" to a new var.
Any idea?
Thank you all!

Reply With Quote
  #2 (permalink)  
Old 03-06-2006
d
 
Posts: n/a
Default Re: preg_match quastion

<kirill_uk@hotmail.com> wrote in message
news:1141612600.759943.298690@e56g2000cwe.googlegr oups.com...
> Hi All, wondering if someone could help me with this.
> I have a variable $var="blh blh blah bldd erter etert";
> i need to get first three words from it so basically i have to
> ,somehow, count first three spaces and get "blh blh blah" to a new var.
> Any idea?
> Thank you all!


$first_three=join(" ", array_slice(explode(" ", $var), 0, 3));

if you want to do it without preg_match :)


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0