Does it look right if you run it through stripcslashes after getting it from the db?
$data = stripcslashes($data);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey Guys,
I was wondering if someone could guide me on the best way to store regex expressions to the DB, and retrieving them.
I'm trying to write a catalog of different nasty code strings, but im finding it quite difficult.
For instance, one expression is
<\?php[\x00-\x1f\s]if\(\!isset\(\$GLOBALS\[\"\\x
When I insert it into the DB using the standard Model::firstOrCreate and then try to extract it, it prints is as follows;
<\\?php[\\x00-\\x1f\\s]if\\(\\!isset\\(\\$GLOBALS\\[\\\"\\\\x
Any help would be greatly appreciated.
Please or to participate in this conversation.