Search
 
SCRIPT & CODE EXAMPLE
 

PHP

convert stdclass to json in php

$stdClass = new stdClass();
$stdClass->name = "avatar";
$stdClass->age = 31;
$json_data = json_encode ((array) $stdClass);
print_r($json_data); //{"name":"avatar","age":31}
Comment

PREVIOUS NEXT
Code Example
Php :: if online php 
Php :: header cross origin using php only for our domains and subdomain 
Php :: print value in laravel console 
Php :: js change h1 value 
Php :: link input button in php 
Php :: stack once laravel 
Php :: php fwrite new line 
Php :: calcul age php datetime 
Php :: wordpress embed shortcode in php 
Php :: php get domain name from url 
Php :: php json_decode 
Php :: php artian migrate table 
Php :: run artisan command from controller 
Php :: magento debug white page 
Php :: php microtime 
Php :: append new line php 
Php :: laravel read origanl value before update 
Php :: laravel get header from request 
Php :: object to array php 
Php :: select sum in laravel 
Php :: laravel make model and migration 
Php :: carbon in laravel 
Php :: xendit callback 
Php :: laravel drop multiple columns 
Php :: php convert date string to number 
Php :: woocommerce check if cart is not empty 
Php :: smarty if 
Php :: php get first last loop 
Php :: laravel 8 $request-intersect not working 
Php :: run raw sql with doctrine manager 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =