"delete first 3 characters and last 3 characters from string php" Answer’s

0

Pass a negative value as the length argument (the 3rd argument) to substr(), like:

$result = substr($string, 3, -3);

So this:

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

Outputs:

n Bri
Wednesday, March 31, 2021
 
Shobit
answered 10 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share