craphunter
craphunter

Reputation: 981

preg_match length width height

I open a csv-file in php and I do have columns with multiple rows that looks like this:

1 | Some word 18x140x2000mm another word
2 | 20x150x300cm couple other words
3 | new words 30x140x2100mm

How do I get with preg_match the length, height, width in the string and even the unit cm, mm.

1 | $attributes = array(18, 140, 2000, mm);
2 | ...

Thanks for help!

Upvotes: 0

Views: 318

Answers (1)

KAREN
KAREN

Reputation: 386

Have You Try This?

(\d+)x(\d+)x(\d+)(\w+)

please let me know if it doesn't work..

Upvotes: 1

Related Questions