SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how can I preg_split a string for each number?

    I need to explode a string in each number, eg:
    PHP Code:
    $string"Real Sporting Gijon 49\' Rondon (1-0)";

    // here whould be the preg_split

    print_r ($exploded_array); 
    This should echo : array (0 -> Real Sporting Gijon 1-> 2-> \' Rondon ... etc)

    Also, is there any way to delete all the combinations of round brackets like "(1-0)" o "(0-0)" from a string?

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    Well... you already know you need a preg_split....
    So... what are you having difficulty with? Defining a pattern for 'a number"?
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  3. #3
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, the whole preg_split syntaxis is a bit confusing, what should be the pattern?

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    ~\d~
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •