2011年4月7日木曜日

JSON形式

■通常配列との比較
・JSON形式
$test = array('1'=>'apple','2'=>'orange','3'=>'peach');
echo json_encode($test);

{"1":"apple","2":"orange","3":"peach"}


・通常配列表示
$test = array('1'=>'apple','2'=>'orange','3'=>'peach');
print_r ($test);

Array ( [1] => apple [2] => orange [3] => peach )


$test = array('1'=>'apple','2'=>'orange','3'=>'peach');
$test2 = join("",$test);
echo $test2;

appleorangepeach

0 件のコメント:

コメントを投稿