Robin de Cock Robin de Cock - 3 years ago 168
PHP Question

explode on "," in PHP does not work

I have a string like this

"data:image/jpeg;base64,/9j/4AAQS...","data:image/jpeg;base64,/9j/4AAQS","data:image/jpeg;base64,/9j/4AAQS"


What i want to do is explode it on the
","

Like this:

$str = explode(" \",\" ",$str);


But it's seems not the work, what did I wrong ?

Answer Source

Instead of explode(" \",\" ",$str); write explode("\",\"",$str);

You had two spaces in your regex that aren't there in your string. Therefore it won't match.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download