fork download
  1. <?php
  2.  
  3. $json = <<<JSON
  4. {
  5. "@context": "http://s...content-available-to-author-only...a.org",
  6. "@type": "QAPage",
  7. "mainEntity": {
  8. "@type": "Question",
  9. "name":"Кто такой \"срочник\" и что значит
  10. служба по
  11. контракту?","text":"", "author": {
  12. "@type": "Person",
  13. "name": "No Book"
  14. },
  15. "dateCreated": "2019-12-06T01:01Z+03:00",
  16. "answerCount": 1,
  17. "upvoteCount": 0,
  18. "suggestedAnswer": [{
  19. "@type": "Answer",
  20. "text": "Деньги
  21. платят",
  22. "author": {
  23. "@type": "Person",
  24. "name": "Болтун Первомайский"
  25. },
  26. "dateCreated": "2019-12-06T01:02Z+03:00",
  27. "upvoteCount": 0,
  28. "url": "https://w...content-available-to-author-only...l.ru/answer/1955965467"
  29. }]}}
  30. JSON;
  31.  
  32. '/"[^"]*(?:""[^"]*)*"/',
  33. function($m) { return str_replace("\n", "\\n", $m[0]); },
  34. $json
  35. );
Success #stdin #stdout 0.02s 24372KB
stdin
Standard input is empty
stdout
stdClass Object
(
    [@context] => http://s...content-available-to-author-only...a.org
    [@type] => QAPage
    [mainEntity] => stdClass Object
        (
            [@type] => Question
            [name] => Кто такой "срочник" и что значит 
служба по 
контракту?
            [text] => 
            [author] => stdClass Object
                (
                    [@type] => Person
                    [name] => No Book
                )

            [dateCreated] => 2019-12-06T01:01Z+03:00
            [answerCount] => 1
            [upvoteCount] => 0
            [suggestedAnswer] => Array
                (
                    [0] => stdClass Object
                        (
                            [@type] => Answer
                            [text] => Деньги 
платят
                            [author] => stdClass Object
                                (
                                    [@type] => Person
                                    [name] => Болтун  Первомайский
                                )

                            [dateCreated] => 2019-12-06T01:02Z+03:00
                            [upvoteCount] => 0
                            [url] => https://w...content-available-to-author-only...l.ru/answer/1955965467
                        )

                )

        )

)