One of the most common methods when working with String is the SUBSTRING, through it you can delete part of a string from a position. In most programming languages, this method gets the position where the string needs to be “cut” in PHP works exactly in this format.

In PHP using the substr() you can pass as parameters the string that will be crafted and also from that point will be breaking the string, check out the example below:

$string = “thisisastring”;
$substr1 = substr($string, 4);
echo (“Text: “. $substr1);

The result of this operation will be “isastring”.

Otherwise using the substr() can not only delete but also say the lenght of the new string. Check out the example:

$string = “thisisastring”;
$substr1 = substr($string, 4, 8);
echo (“Text: “. $substr1);

The result of this operation will be “isastrin” where the cut starts from the fourth character and the string will have the lenght 8.


Using this method you can perform many activities of daily programming. Test this and other functions in PHP in Scriptcase in our development tool takes you not only to study methods that do not know and all the features that can make your everyday life much more agile. Access the e-learning section of our site and learn more, download the free version now Scriptcase and start enjoying right now all the advantages that this offers fantastic tool.

You might also like…

Scriptcase & Web Services

This time I will explain how to work with web services inside the Scriptcase, directly with PHP and...

More updates in 9.4 version

Recently version 9.4 was released bringing a new design concept to the generated applications of Sc...

Taking a look at version 9.4

Scriptcase released its version 9.4, and this one brings many interesting news, specially regarding...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at Learn more about our Privacy Police.