Re: PHP functions to convert markup efficiently [message #183818 is a reply to message #183811] |
Thu, 21 November 2013 20:27 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
James Harris wrote:
> I am looking for a way to mark up text in a way that PHP would be able to
> efficiently and quickly convert to HTML.
You are probably looking for a template engine like <http://www.smarty.net/>
then.
> […]
> For example, it looks like I could choose between PHP's expand(), fgets()
> and regular expression handling.
There is no built-in expand() function in PHP. fgets() reads files line by
line; HTML converts whitespace outside of attribute values to one space –
not what you want. Regular expressions are used for pattern matching; I do
not see how they would be applicable here.
> Of course, implemenations may differ slightly but, on average, are there
> certain PHP approaches that could be expected to be faster than others?
> What is the accepted wisdom?
Depends on what you *really* want to do.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
|
|
|