title: PHP Key Multiple Values to JSON
body: <p>I have an array that has a key, and the value is an array with values;
   The key is a word, and the values are synonyms; so it would look like this</p>
  
  <pre><code>$arr = array();
  $syns = ['hi','wassip','yeaboy','heya','heo'];
  $arr["hello"] = $syns;
  
  foreach($arr as $key=&gt;$value){
     foreach($value as $word){
        echo $key."   ".$word."\n";
     }
  }
  </code></pre>
  
  <p>this will disply each word, and each synonym for the word.</p>
  
  <p>Can this be converted into json format? I am trying to pass this from one page to another, either through javascript, php, or however. How can I pass this array of synonyms for each word?</p>