Jump to content

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


edwardtilbury

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.