title: Using PHP Gettext Extension vs PHP Arrays in Multilingual Websites?
body: <p>So far the only 2 good things that I've seen about using gettext instead of arrays is that I don't have to create the "greeting" "sub-array" (or whatever its called). And I don't have to create a folder for the "default language".</p>
  
  <p>Are there other pros and cos of using gettext and php arrays for multilingual websites?</p>
  
  <p><strong>USING GETTEXT:</strong></p>
  
  <p><strong>spanish/messages.po:</strong></p>
  
  <pre><code>#: test.php:3
  msgid "Hello World!"
  msgstr "Hola Mundo"
  </code></pre>
  
  <p><strong>index.php:</strong></p>
  
  <pre><code>&lt;?php echo _("Hello World!"); ?&gt;
  </code></pre>
  
  <p><strong>index.php?lang=spanish:</strong></p>
  
  <pre><code>&lt;?php echo _("Hello World!"); ?&gt; turns to Hola Mundo
  </code></pre>
  
  <p><strong>USING PHP ARRAYS:</strong></p>
  
  <p><strong>lang.en.php</strong></p>
  
  <pre><code>&lt;?php
  $lang = array(
      "greeting" =&gt; "Hello World",
  );
  ?&gt;
  </code></pre>
  
  <p><strong>lang.es.php</strong></p>
  
  <pre><code>&lt;?php
  $lang = array(
      "greeting" =&gt; "Hola Mundo",
  );
  ?&gt;
  </code></pre>
  
  <p><strong>index.php:</strong></p>
  
  <pre><code>&lt;?php echo $lang['greeting']; ?&gt; greeting turns to Hello World
  </code></pre>
  
  <p><strong>index.php?lang=spanish</strong></p>
  
  <pre><code>&lt;?php echo $lang['greeting']; ?&gt; greeting turns to Hola Mundo
  </code></pre>
  
  <p>(I first started with gettext, but it wasn't supported in my shared free hosting Zymic. I didn't want to use Zend_translate, I found it too complicated to my simple task, so I finally ended up using php <code>define</code>, but later on someone told me I should use arrays)</p>