Due to recent development needs, after encrypting the password with MD5, it involves intercepting the ciphertext string. So I wrote this blog, I hope everyone will support it.
//Constructed string
$str = "ajafafpaffafdfdfd";
echo "Original string".$str."";
$str1 = substr($str,5) ;
echo "Truncate from the fifth character to the last ".$str1."";
$str2 = substr($str,0,4);
echo "Take 4 characters from the 0th character:" .$str2."";
$str3 = substr($str,-5);
echo "Take the last 5 characters:".$str3."";
$str4 = substr($str,-8,4 );
echo "Truncate 4 characters starting from the 8th character from the bottom:".$str4."";
$str5 = substr($str,-8,-2);
echo "Start from the 8th character from the bottom Start intercepting the last 2 characters: ".$str5."";
?>
The above introduces the commonly used interception operations of strings in PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.