Home >Backend Development >PHP Problem >Modifiers not supported by PHP

Modifiers not supported by PHP

藏色散人
藏色散人Original
2019-10-11 15:59:083286browse

Modifiers not supported by PHP

The modifier that PHP does not support is the /e modifier.

Modifiers not supported by PHP

For specific modifiers, please refer to the following address:

Available pattern modifiers in regular expression pattern:

http://php.net/manual/zh/reference.pcre.pattern.modifiers.php

Example:

$_smarty="ok";
$_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s','date("Y-m-d H:i:s")',$_smarty);

After changing to preg_replace_callback:

$_smarty_results = preg_replace_callback('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s',function($match){return date("Y-m-d H:i:s");},$_smarty_results);

For more PHP-related knowledge, please visit PHP中文网!

The above is the detailed content of Modifiers not supported by PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn