The Web Blinders logo

Programming

PHP ARRAY TO JSON CONVERSION EXAMPLE

<?php
$arr = array(
    'host' => 'localhost',
    'user' => 'root',
    'password' => 'root',
    'database' => 'accounts',
    'mysqlport' => 3306,
);

$jsonString=json_encode($arr);
echo $jsonString;

/*

{
   "host":"localhost",
   "user":"root",
   "password":"root",
   "database":"accounts",
   "mysqlport":3306
}

*/                      

ALTERNATE TITLES

Convert array to json

json_encode() php example

how to use json_encode()

Need developers ?

if so, send a message.

thewebblinders@gmail.com

More Programming from our blog

SEARCH FOR ARTICLES