Home  >  Article  >  Backend Development  >  Development process of php intercepting strings between specified strings

Development process of php intercepting strings between specified strings

黄舟
黄舟Original
2017-08-15 13:18:512105browse

In the previous course we introduced detailed explanations of examples of php intercepting substrings without destroying words Friends who have read the previous article should know that php can intercept strings without destroying them. words, and I believe that everyone has a certain understanding of string interception, so today we will introduce to you how PHP intercepts the strings between specified strings. To put it simply, it means to intercept this string, from where Start intercepting and end there!

We still use the PHP class. First, we start downloading the PHP class we need to use to intercept the strings between the specified strings: http://www.php.cn/xiazai/leiku/ 611

Then decompress the downloaded php class file locally and create a new php file locally. We need to use this file to call this class!

Instantiate this class:

<?php
include_once "str.php";//引入文件

$obj = new get_c_str; //实例化类
echo $obj->get_str("(www.php.cn)","(",")");

What we mean above is to intercept from the left '(', and then end with ')'!

The running results are as follows:

Development process of php intercepting strings between specified strings

The above is the detailed content of Development process of php intercepting strings between specified strings. 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