S
S
Space2018-04-28 14:35:53
PHP
Space, 2018-04-28 14:35:53

What unique character to use for explode?

I connect the data I need into a string through the delimiter ";" Further I receive: And there was a problem that in $var2 there can be any text and there if there is a symbol ";" , then it breaks incorrectly. What kind of unique character (or set of characters) can you come up with that will definitely not be used in the text? Or how to solve it?
$getJson = sprintf("%s;%s, $var, $var2);
explode(';', $getJson);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Camaro67, 2018-04-28
@ruslite

No, just work with JSON as with JSON, and do not fence the bike.

$json = json_encode([$var, $var2]);
$array = json_decode($json);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question