Jump to content

Needles in Haystack, no idea how to parse / break apart...


Recommended Posts

Like this:

 

<?php
$numbers = array();
$subject = 'This 19th century easter egg basket includes the following parts: A giant robot from the year 2008 (12345), Left window trim for a 1993-2001 Lexus SC400 (12346), and a 1/6th scale papier-mache head of Ron Paul made from native indians in Luxembourg';
$pattern = '/\(([\d]+)\)/';
preg_match_all($pattern, $subject, $numbers);
$numbers = array_pop($numbers);
print_r($numbers);
?>

 

I was being facetious :P.  Either way, it is a creative solution.

 

WORKS!!

I'm sure the other ones work as well, IMHO you are all winner, but I if I have to choose, I would say FLYHONEY.

 

I need to read my PHP book again!

 

THANKS TO EVERYONE FOR THE HELP! ;D ;D ;D ;D ;D ;D ;D ;D

I concur.

 

Results and times

Barand Array
(
    [0] => 12345
    [1] => 12346
)

FlyHoney Array
(
    [0] => 12345
    [1] => 12346
)

Blade Array
(
    [0] => This 19th century easter egg basket includes the following parts: A giant robot from the year 2008 
    [1] => 12345 Left window trim for a 1993-2001 Lexus SC400 
    [2] => 12346 and a 1/6th scale papier-mache head of Ron Paul made from native indians in Luxembourg

)

CV Array
(
    [0] => 19
    [1] => 2008
    [2] => 12345
    [3] => 1993
    [4] => 2001
    [5] => 400
    [6] => 12346
    [7] => 1
    [8] => 6
)

Barand       : 0.000859
FlyHoney     : 0.000307
Blade        : 0.000095
CV           : 0.001316

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.