safeDecode() public static method

Decodes a JSON string
public static safeDecode ( string $string, boolean $asArray = false ) : mixed
$string string
$asArray boolean
return mixed
示例#1
0
 /**
  * @test
  */
 public function shouldResetJsonError()
 {
     //given
     Json::safeDecode("error");
     Json::safeDecode("");
     //when
     $error = Json::lastError();
     //then
     $this->assertEquals(JSON_ERROR_NONE, $error);
 }