S
S
Streetfox82017-09-29 21:54:39
PHP
Streetfox8, 2017-09-29 21:54:39

How to extract a number from a string in php?

Hello dear php-experts!
Tell me how to extract 102 from such a string "{\"response\":{\"post_id\":102}}" in php, you will help me a lot! Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D3lphi, 2017-09-29
@D3lphi

$json = json_decode("{\"response\":{\"post_id\":102}}", true);
$result = $json['response']['post_id'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question