PHP 5.2 Notice: Use of undefined constant __DIR__ - assumed '__DIR__
<p>In php 5.3 or less it'll provide an error like the following:</p>

<pre><code>Notice: Use of undefined constant __DIR__ - assumed '__DIR__
</code></pre>

<p>It's because i'm using the magic constant <code>__DIR__</code>. Is there an alternative to using <code>__DIR__</code> in 5.3 or less??</p>

<p>Here's the code that's causing it:</p>

<pre><code>&lt;?php
/**
 * Load template files
 *
 * $files   Contains alphabetized list of files that will be required
 */
$files = array(
  'elements.inc',
  'form.inc',
  'menu.inc',
  'theme.inc',
);

function _zurb_foundation_load($files) {
  $tp = drupal_get_path('theme', 'zurb_foundation');
  $file = '';

  // Workaround for magic constant; for now because of php 5.2 issue
  // http://drupal.org/node/1899620#comment-6988766
  if( !defined( __DIR__ ) )define( __DIR__, dirname(__FILE__) );

  // Check file path and '.inc' extension
  foreach($files as $file) {
    $file_path = __DIR__ .'/inc/' . $file;
    if ( strpos($file,'.inc') &gt; 0 &amp;&amp; file_exists($file_path)) {
      require_once($file_path);
    }
  }
}

_zurb_foundation_load($files);
</code></pre>
