php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #15650 function highlight_string() returns string
Submitted: 2002-02-20 17:57 UTC Modified: 2002-02-27 09:08 UTC
From: rein at velt dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.1 OS:
Private report: No CVE-ID: None
 [2002-02-20 17:57 UTC] rein at velt dot net
At  this moment (php4.1.1) the function "highlight_string" has the following
syntax:


[quote]
bool highlight_string ( string str)
This function prints out a syntax highlighted version of str using the
colors defined in the built-in syntax highlighter for PHP. Returns TRUE or
FALSE.
[/quote]



The function will be more flexible if it returns a string (with highlights)
and nothing is printed directly. 

str highlight_string ( string str)
This function returns a string containing a syntax highted version of str
using the colors defined in the built-in syntax highlighter for PHP. Returnes a string with syntax-highlighted html

Reference: http://lxr.php.net/source/ZendEngine2/zend_highlight.c#84

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-20 18:04 UTC] cynic@php.net
ob_start();
highlight_string($str);
$ob = ob_get_contents();
ob_end_clean();

wrap this in a function.


 [2002-02-20 18:57 UTC] sniper@php.net
Not so fast, Derick actually did this already in CVS:

ChangeLog:
- Added optional parameter to highlight_string and highlight_file which makes these functions return a highlighted string instead of dumping to standard output. 


It's just not documented at all.

--Jani

 [2002-02-27 09:08 UTC] sander@php.net
This bug has been fixed in CVS.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Aug 06 06:00:02 2025 UTC