[development] coding standard question

mark burdett mfburdett at gmail.com
Mon Aug 27 19:10:26 UTC 2007


Hi, in some simple command-line tests I could not find a difference (in php 5.2)

  true: 1.32612895966  TRUE: 1.38275790215
  true: 1.34794092178  TRUE: 1.39009809494
  true: 1.34102320671  TRUE: 1.38674616814
  true: 1.2856991291  TRUE: 1.27452993393
  true: 1.34056401253  TRUE: 1.2749080658
  true: 1.31166195869  TRUE: 1.33323001862
  true: 1.34053897858  TRUE: 1.27428483963
  true: 1.28342199326  TRUE: 1.33444595337

<?php
$loop = 0;
while ($loop < 8) {
  $count = 0;
  $start = microtime(true);
  while ($count < 4000000) {
    $test = true;
    if (true) {
      $count++;
    }
  }
  echo '  true: ';
  echo microtime(true) - $start;

  $count = 0;
  $start = microtime(true);
  while ($count < 4000000) {
    $test = TRUE;
    if (TRUE) {
      $count++;
    }
  }
  echo '  TRUE: ';
  echo microtime(true) - $start;
  echo "\n";
  $loop++;
}

--mark

On 8/27/07, Karoly Negyesi <karoly at negyesi.net> wrote:
> I do not believe that true could be faster than TRUE when php is case agnostic about its identifiers. Maybe there is time taken to lowercase TRUE ... but if you can measure lowercasing four characters in the parsing stage where only ASCII is supported, congratulations.
>
> About commas, yes the D5 menu defintiions are ugly sometimes. Have you seen D6 :) ?
>


More information about the development mailing list