I am new to programming and I'm trying to build a little php price comparison script for personal use. I allready managed to parse a site of a webshop (using simple dom parser), and get a (sort of) cleaned up string with a tier and a price in it.
The strings I am working with are now formated like this:
" 50 27,00 " //50 pieces of a product cost €27,00 (without the ""s)
"1000 26,60 " //1000 pieces of a product cost €26,60
I want to grab the first part of the string to $tier, and the second part (including the comma) to the string $price.
Can you help me how to do this? Sometimes the spaces to begin the string with vary (see example above. There are always 2 white spaces in the middle.
An array would be fine also if I could get it like this (whithout the spaces):
$pricearray = array(50, "27,00"); //string to number will be my next problem to solve, first things first
I think I have to use preg_split, but don't now the expression to use.
Thank you for thinking with me.