Codice PHP:
// C
int main(int argcchar *argv[]) {
    
char         *str;
    for(
argc 0argc 90argc++) {
        
str = (char *)calloc(((argc 10 2) + 2), sizeof(char));
        
sprintf(str" %i "argc);
        
printf("%i\n"virtualSmorfia(str));
        
free(str);
    }
    return 
0;

Codice PHP:
// JavaScript
function virtualSmorfia(str) {
    
str str.replace(/^\s+|\s+$/g"");
    var 
0str.length0;
    
str hex_md5(str);
    while(
32)
        
+= str.charCodeAt(a++);
    return 
Math.floor(b) % 90 || 90;
}; 
Codice PHP:
// Python
import md5
def virtualSmorfia
(str):
    
str str.strip()
    
0len(str); 0
    str 
md5.new(str).hexdigest()
    while(
32):
        
ord(str[a]); 1
    
return ((int)(b) % 90) or 90 
Codice PHP:
// PHP
function virtualSmorfia($str) {
    
$str trim($str);
    
$a 0$b strlen($str); $c 0;
    
$str md5($str);
    while(
$a 32)
        
$c += ord(substr($str$a++, 1));
    
$c = (int)($c $b) % 90;
    return 
$c === 90 $c;

Codice PHP:
// ActionScript
function virtualSmorfia(str:String):Number {
    
str trim(str);
    var 
a:Number 0b:Number str.lengthc:Number 0m:md5 = new md5();
    
str m.hash(str);
    while(
32)
        
+= str.charCodeAt(a++);
    return 
Math.floor(b) % 90 || 90;


come vedi l'highlight_string di PHP fa già quello che cerchi su una funzione built_in, molto veloce ... tutto quello che devi verificare è se il tag di apertura codice
<?php
è presente o meno nella stringa ... se non c'è lo metti all'inizio, fai l'highlight e poi lo rimuovi dalla stringa "highlightata"


P.S. ovviamente Geshi è una cosa più professionale ma secondo me non così indispensabile, resta di fatto uno dei più noti e funzionali