Every now and then I stumble upon a tidbit of information that just makes me want to kick myself. Today was one of those days. Just by chance I ended up at an entry on PHP.net while Googling another issue. Once I realized what this function was capable of I was torn between thinking “Wow, this is awesome!” and “Wow, I’m a dumbass!”
$array = array ( 'alpha'=>4, 'beta'=>9, 'gamma'=>3 ); echo json_encode($array)
You should then see something like the following:
{"alpha":4,"beta":9,"gamma":3}
If you were manually processing the array and building a JSON object like I was, assume the face palm position.
A seasoned Senior Solutions Architect with 20 years of experience in technology design and implementation. Renowned for innovative solutions and strategic insights, he excels in driving complex projects to success. Outside work, he is a passionate fisherman and fish keeper, specializing in planted tanks.
Only registered users can comment.