Ouzo\Utilities\Json::encode PHP Метод

encode() публичный статический Метод

Returns the JSON representation of the $value
public static encode ( array | JsonSerializable $value ) : string
$value array | JsonSerializable
Результат string
    public static function encode($value)
    {
        return json_encode($value);
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function shouldEncodeArrayToJson()
 {
     //given
     $array = array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3');
     //when
     $encoded = Json::encode($array);
     //then
     $this->assertEquals('{"key1":"value1","key2":"value2","key3":"value3"}', $encoded);
 }
All Usage Examples Of Ouzo\Utilities\Json::encode