Oh god... ROTF -- having PHP problems and reading these answers is actually BETTER than not having any PHP problems at all "the formatting looks like something from the 1990's" hahahaha -- you caught me! THATS when I learned PHP! Actually, more correctly stated: "That's when I learned PHP, enough to really screw things up" hahahah
Okay I'll try my best to answer your questions WITHOUT giving away the website I'm trying to scrape..... ;-)
The data, when the data is valid, looks like this:
$string = 'BEST 25.65, MEDIUM 4.75, WORST 20.5, BEST 4, MEDIUM 8.9, WORST 160.31, BEST 15.65, MEDIUM 5.33, WORST 160.31, FINISHED';
And my preg_match_all works fine, because it finds those numeric digits.
However, the data, when SOME results are NOT returned, looks like this:
$string = 'BEST:NULL:MEDIUM:NULL:WORST:NULL:BEST 4, MEDIUM 8.9, WORST 160.31, BEST 15.65, MEDIUM 5.33, WORST 160.31, FINISHED';
That first set of "Best:NULL...etc" causes my WHOLE preg_match_all to fail.
So I'm somehow trying to put an "if(!EMPTY)" line of code in there so the preg_match_all will simply return "0.00" for the first part of the returned data which has those "nulls" in it.
e.g. array(
[0] best=>0.00,
medium=>0.00,
worst=>0.00
[1] best=>4
medium=>8.9
worst etc., etc.
Leaving my code as it is now just causes my whole regex to fail and I get nothing out of the scrape.
Note: I leared a long time ago when posting questions on forums to NEVER give the exact code and the exact script, because then it's like asking the experts (NogDog, Weedpacket, et al) to code for you for free....
So I'm trying to ask actual "teaching/learning" questions..... like the "give a man a fish, eat for a day, teach a man to fish, etc.,) so I'm always careful to phrase my questions so I can learn how to do stuff on my own 🙂