Skip to content

Commit

Permalink
docs: add documentation for WordPress.PHP.POSIXFunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymcp committed Jun 13, 2024
1 parent 29488fe commit 6290b3f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions WordPress/Docs/PHP/POSIXFunctionsStandard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd"
title="POSIX Functions"
>
<standard>
<![CDATA[
POSIX regular expression (regex) functions are deprecated in PHP 5.3, and removed completely in PHP 7.0. Perl compatible regular expression (PCRE) functions (preg_*) should be used instead.
]]>
</standard>
<code_comparison>
<code title="Valid: Regex operations performed using PCRE functions.">
<![CDATA[
preg_match( '/[A-Za-z]+/', $title, $matches );
preg_match( '/[a-z]+/i', $title, $matches );
preg_replace( '/Foo/', 'Bar', $string );
preg_replace( '/Foo/i', 'Bar', $string );
list( $h, $m ) = preg_split( '/:/', $time );
$words = explode( ' ', $string, 4 );
preg_match( '/Foo/i', $title, $matches );
]]>
</code>
<code title="Invalid: Regex operations performed using deprecated POSIX functions.">
<![CDATA[
ereg( '[A-Za-z]+', $title, $matches );
eregi( '[a-z]+', $title, $matches );
ereg_replace( 'Foo', 'Bar', $string );
eregi_replace( 'Foo', 'Bar', $string );
list( $h, $m ) = split( ':', $time );
$words = spliti( ' ', $string, 4 );
ereg( sql_regcase( 'Foo' ), $title, $matches );
]]>
</code>
</code_comparison>
</documentation>

0 comments on commit 6290b3f

Please sign in to comment.