Drupal-check.org - php http://www.drupal-check.org/check/33 en Use Drupal replacement functions http://www.drupal-check.org/node/65 <p>When developping a module, we often use some commonly used PHP functions. As you may not know Drupal provides some overrides for these functions. They are often related to strings, they have the same name as their PHP native equivalent except that they are prefixed with <span class="geshifilter"><code class="text geshifilter-text">drupal_</code></span>. Here is a list of PHP functions you should replace with its Drupal equivalent:</p> <ul> <li>Replace <span class="geshifilter"><code class="text geshifilter-text">strlen()</code></span> with <span class="geshifilter"><code class="text geshifilter-text">drupal_strlen()</code></span></li> <li>Replace <span class="geshifilter"><code class="text geshifilter-text">strtoupper()</code></span> with <span class="geshifilter"><code class="text geshifilter-text">drupal_strtoupper()</code></span></li> <li>Replace <span class="geshifilter"><code class="text geshifilter-text">strtolower()</code></span> with <span class="geshifilter"><code class="text geshifilter-text">drupal_strtolower()</code></span></li> <li>Replace <span class="geshifilter"><code class="text geshifilter-text">ucfirst()</code></span> with <span class="geshifilter"><code class="text geshifilter-text">drupal_ucfirst()</code></span></li> <li>Replace <span class="geshifilter"><code class="text geshifilter-text">substr()</code></span> with <span class="geshifilter"><code class="text geshifilter-text">drupal_substr()</code></span></li> <li>Replace <span class="geshifilter"><code class="text geshifilter-text">eval()</code></span> with <span class="geshifilter"><code class="text geshifilter-text">drupal_eval()</code></span></li> <li>Replace <span class="geshifilter"><code class="text geshifilter-text">clone</code></span> with <span class="geshifilter"><code class="text geshifilter-text">drupal_clone()</code></span></li> </ul> <p>For more on this, you should <strong>read</strong> <span class="geshifilter"><code class="text geshifilter-text">includes/unicode.inc</code></span> and <span class="geshifilter"><code class="text geshifilter-text">includes/common.inc</code></span>.</p> Development code function php Drupal 5.x Drupal 6.x Drupal 7.x Mon, 15 Jun 2009 08:56:58 +0000 jchatard 65 at http://www.drupal-check.org