In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to replace the first php preg, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Php preg to replace the first method: 1, create a PHP sample file; 2, through the "function str_replace_limit ($search, $replace, $subject, $limit=-1)" method to achieve replacement.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
How does php preg replace the first one?
PHP replacement, replacing only the first match
Function str_replace_limit ($search, $replace, $subject, $limit=-1) {if (is_array ($search)) {foreach ($search as $k = > $v) {$search [$k] ='`'. Preg_quote ($search [$k],''). '`';}} else {$search =' `'. Preg_quote ($search,''). '`';} return preg_replace ($search, $replace, $subject, $limit);}
Copy the code
$search: the string or array to replace
$replace: the value to replace
$subject: text to replace
$limit: this number replaced
Php what to use php is a nested acronym, is an English hypertext preprocessing language, its syntax mixed C, Java, Perl and php self-innovative syntax, mainly used to do website development, many small websites are developed in php, because php is open source, which makes php enduring.
On how to replace the first php preg to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.