How to Remove Last Three Characters from String in PHP?

Hello Friends Today, through this tutorial, I will tell you how to Remove Last Three Characters from String with the help of php.

<?php
$string = "abcdefgh";
echo substr($string, 0, -3);
?>

As you have been told by the example above. If you want to run this code on the server, then you will first have to create a php file. And then add the above code to the php file. Then go to your server and run your file.

<?php 
$three_string = "zyxwvu"; 
echo substr($three_string, 0, -3); 
?>