Today, I re-implemented Object-Oriented Programming and learned the magic of _ construct, a parameter of an instantiated object, and the magic method executed before the destruction of an object.
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. "<br> ";
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. "<br> ";
If ($ isStr ){
$ P = strpos ($ nString, $ string, $ p );
} Else {
$ P = stripos ($ nString, $ string, $ p );
}
$ P ++;
} While ($ goNum> = 0 );
$ P --;
Return substr ($ nString, 0, $ p );
}