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 uses the MVC template?

Maybe you might have thought about this at some point, “Scriptcase uses the MVC templates?" Well, ...

How to implement A2F using Own Development in NodeJS in a Scriptcase application

A2F using Own Development in NodeJS A2F: In a previous article, we talked about Swivel as an extern...

Specialists or generalists, who gets a better advantage by using Scriptcase?

Hey there! Today  we will figure what are the ideal profiles for those who wish to take advantage o...

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.