mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
Fix #36112 (Bad example removed)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@214904 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
aa617da6c7
commit
b287313c6b
1 changed files with 1 additions and 45 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<!-- splitted from ./en/functions/pcre.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.preg-replace">
|
||||
<refnamediv>
|
||||
|
@ -172,50 +172,6 @@
|
|||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Convert HTML to text</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// $document should contain an HTML document.
|
||||
// This will remove HTML tags, javascript sections
|
||||
// and white space. It will also convert some
|
||||
// common HTML entities to their text equivalent.
|
||||
$search = array ('@<script[^>]*?>.*?</script>@si', // Strip out javascript
|
||||
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
|
||||
'@([\r\n])[\s]+@', // Strip out white space
|
||||
'@&(quot|#34);@i', // Replace HTML entities
|
||||
'@&(amp|#38);@i',
|
||||
'@&(lt|#60);@i',
|
||||
'@&(gt|#62);@i',
|
||||
'@&(nbsp|#160);@i',
|
||||
'@&(iexcl|#161);@i',
|
||||
'@&(cent|#162);@i',
|
||||
'@&(pound|#163);@i',
|
||||
'@&(copy|#169);@i',
|
||||
'@&#(\d+);@e'); // evaluate as php
|
||||
|
||||
$replace = array ('',
|
||||
'',
|
||||
'\1',
|
||||
'"',
|
||||
'&',
|
||||
'<',
|
||||
'>',
|
||||
' ',
|
||||
chr(161),
|
||||
chr(162),
|
||||
chr(163),
|
||||
chr(169),
|
||||
'chr(\1)');
|
||||
|
||||
$text = preg_replace($search, $replace, $document);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using backreferences followed by numeric literals</title>
|
||||
|
|
Loading…
Reference in a new issue