Php practice 13th-PHP Tutorial

Source: Internet
Author: User
Php practices: 13th days. Today, we re-developed object-oriented programming, I realized _ construct, a magic method for instantiating object parameters, and _ destruct, a magic method executed before an object is destroyed, and _ get to obtain private. today I re-implemented object-oriented programming, the magic method of _ construct a instantiated object parameter is also known as _ destruct the magic method executed before an object is destroyed.
And
_ Get: the first parameter for obtaining private member attributes is the obtained name.
_ Set the first parameter for setting the private member attribute is the member name, and the second parameter is the passed value.
_ Call: if no method is found, the first parameter is the name of the call, and the second parameter is the passed parameter.
_ Isset is used to determine whether a member has the first parameter member name.
_ Unset is called when a member is destroyed.
[Php]
/*
* Function strmin: for example, if you want to get the full text as "12345", you need to retrieve "3", "2" before <3>, and "4" after <3> ",
* The parameter $ nString is of the text type. for example, if you want to obtain the full text, the value is 12345.
* The parameter $ sString is of the text type. the parameter is preceded by "2 ",
* Parameter $ eString text type, followed by "4"
* The parameter $ position is an integer that can be null. it indicates the start position of the text to be searched.
* Parameter $ isStr, logical type, can be empty. the default value is case-insensitive.
*/
Function strmin ($ nString, $ sString, $ eString, $ position = 0, $ isStr)
{
If ($ isStr ){
$ S = strpos ($ nString, $ sString, $ position );


$ E = strpos ($ nString, $ eString, $ s );
} Else {
$ S = stripos ($ nString, $ sString, $ position );


$ E = strpos ($ nString, $ eString, $ s );
}
$ S = $ s + strlen ($ sString );
$ E = $ e-$ s;
Return substr ($ nString, $ s, $ e );


}


/*
* The strleft function starts from the left side of the text and searches for the text to be searched.
* Parameter $ nString text type, the searched text
* Parameter $ string text type, the text to be searched
* The parameter $ position is an integer that can be null. it indicates the start position of the text to be searched.
* Parameter $ isStr, logical type, can be empty. the default value is case-insensitive.
* The parameter $ goNum is an integer that can be null. the number of skipping times is 0 by default.
*/
Function strleft ($ nString, $ string, $ position = 0, $ isStr = false, $ goNum = 0)
{
$ P = $ position;


Do {

$ GoNum --;
Echo $ p ."
";


If ($ isStr ){
$ P = strpos ($ nString, $ string, $ p );
} Else {
$ P = stripos ($ nString, $ string, $ p );
}

$ P ++;


} While ($ goNum> = 0 );


$ P --;
Return substr ($ nString, 0, $ p );
}

/*
* Function strmin: for example, if you want to get the full text as "12345", you need to retrieve "3", "2" before <3>, and "4" after <3> ",
* The parameter $ nString is of the text type. for example, if you want to obtain the full text, the value is 12345.
* The parameter $ sString is of the text type. the parameter is preceded by "2 ",
* Parameter $ eString text type, followed by "4"
* The parameter $ position is an integer that can be null. it indicates the start position of the text to be searched.
* Parameter $ isStr, logical type, can be empty. the default value is case-insensitive.
*/
Function strmin ($ nString, $ sString, $ eString, $ position = 0, $ isStr)
{
If ($ isStr ){
$ S = strpos ($ nString, $ sString, $ position );


$ E = strpos ($ nString, $ eString, $ s );
} Else {
$ S = stripos ($ nString, $ sString, $ position );


$ E = strpos ($ nString, $ eString, $ s );
}
$ S = $ s + strlen ($ sString );
$ E = $ e-$ s;
Return substr ($ nString, $ s, $ e );


}


/*
* The strleft function starts from the left side of the text and searches for the text to be searched.
* Parameter $ nString text type, the searched text
* Parameter $ string text type, the text to be searched
* The parameter $ position is an integer that can be null. it indicates the start position of the text to be searched.
* Parameter $ isStr, logical type, can be empty. the default value is case-insensitive.
* The parameter $ goNum is an integer that can be null. the number of skipping times is 0 by default.
*/
Function strleft ($ nString, $ string, $ position = 0, $ isStr = false, $ goNum = 0)
{
$ P = $ position;


Do {

$ GoNum --;
Echo $ p ."
";


If ($ isStr ){
$ P = strpos ($ nString, $ string, $ p );
} Else {
$ P = stripos ($ nString, $ string, $ p );
}

$ P ++;


} While ($ goNum> = 0 );


$ P --;
Return substr ($ nString, 0, $ p );
}


Into _ construct a magic method for instantiating object parameters and _ destruct the magic method executed before an object is destroyed and _ get to obtain private...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.