Taking a Substring in PHP
How To Take a Substring from a Given String?
If you know the position of a substring in a given string, you can take the substring out by the substr() function. Here is a PHP script on how to use substr():
<?php $string = "beginning"; print("Position counted from left: ".substr($string,0,5)."\n"); print("Position counted form right: ".substr($string,-7,3)."\n"); ?>
This script will print:
Position counted from left: begin Position counted form right: gin
substr() can take negative starting position counted from the end of the string.
2016-10-13, 1200👍, 0💬
How to login to Azure API Management Publisher Portal 2017 version? If you have given access permiss...
How to send an FTP request with the urllib.request.urlopen() function? If an FTP server supports ano...
Where to find tutorials on how to work with MySQL Database in PHP? A collection of tutorials to answ...
How To Connect to MySQL from a PHP Script in PHP? If you want access the MySQL server, you must crea...
Where to find tutorials on the 2017 version of API Management Services at Azure Portal? Here is a li...