PHP Syntax Highlighting ommiting comments

Note, the last comment is missing when highlighted with php but not code tags.

Although upon edit, the comment is preserved.

Ta! :wink:


<?php
$array = array();
$sorted = array();

$alphabet = range('a', 'z');

for($i = 0; $i < 10000; $i++){
    array_push(
        $array,
        $alphabet[rand(0, 25)]
    );
}

$start = microtime(true);
$sorted = array_count_values($array);
printf('Took: %s seconds', microtime(true) - $start);
#Took: 0.000902891159058 seconds

$start = microtime(true);
foreach($array as $value){
    $sorted[$value]++;
}
printf('Took: %s seconds', microtime(true) - $start);
#Took: 0.00357103347778 seconds


<?php
$array = array();
$sorted = array();

$alphabet = range('a', 'z');

for($i = 0; $i < 10000; $i++){
    array_push(
        $array,
        $alphabet[rand(0, 25)]
    );
}

$start = microtime(true);
$sorted = array_count_values($array);
printf('Took: %s seconds', microtime(true) - $start);
#Took: 0.000902891159058 seconds

$start = microtime(true);
foreach($array as $value){
    $sorted[$value]++;
}
printf('Took: %s seconds', microtime(true) - $start);
#Took: 0.00357103347778 seconds

The syntax dropdown in the post editor works correctly:

<?php
$array = array();
$sorted = array();

$alphabet = range('a', 'z');

for($i = 0; $i < 10000; $i++){
    array_push(
        $array,
        $alphabet[rand(0, 25)]
    );
}

$start = microtime(true);
$sorted = array_count_values($array);
printf('Took: &#37;s seconds', microtime(true) - $start);
#Took: 0.000902891159058 seconds

$start = microtime(true);
foreach($array as $value){
    $sorted[$value]++;
}
printf('Took: %s seconds', microtime(true) - $start);
#Took: 0.00357103347778 seconds

I’m assuming this is a bug in vBulletin and not specific to SitePoint, so reporting it to them is probably the best way to get it fixed.