Answers for "json object to string php"

PHP
1

object to string php

(string)$yourObject;
Posted by: Guest on September-12-2020
0

php object to string

__toString() & {$this->name}
Posted by: Guest on June-27-2020
0

php object to json

function getJsonData(){
    $var = get_object_vars($this);
    foreach ($var as &$value) {
        if (is_object($value) && method_exists($value,'getJsonData')) {
            $value = $value->getJsonData();
        }
    }
    return $var;
}
Posted by: Guest on July-04-2021

Code answers related to "json object to string php"

Browse Popular Code Answers by Language