RE: [PHP] Q. Adding line numbers to highlighted source

From: Date: Fri, 04 Apr 2003 12:54:25 +0000
Subject: RE: [PHP] Q. Adding line numbers to highlighted source
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142314@lists.php.net to get a copy of this message
> I've been trying to add line-numbers to my source code, but can't seem to > work out how to do it. This works. The line numbers end up colored the same as the line, though. <? $fp = fopen('example.php','r'); $file = fread($fp,filesize('example.php')); $h_file = highlight_string($file,TRUE); $h_file = str_replace("<code>","<code>1 ",$h_file); $count=2; $nh_file = preg_replace("/<br \/>/e",'"<br />".$count++." "',$h_file); echo $nh_file; ?> ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#142314) next »