Answers for "php take last 5 character of string"

PHP
10

get last character of string php

substr("testers", -1); // returns "s"
Posted by: Guest on March-05-2020
0

Get the Last Character of a String in PHP

phpCopy<?php 
$string = "This is a string";
$lastCharPosition = strlen($string) - 1;  
for ($x = $lastCharPosition; $x < strlen($string); $x++) {
    $newString = $string[$x]; 
} 
echo "The last char of the string is $newString.";
?>
Posted by: Guest on April-23-2021

Code answers related to "php take last 5 character of string"

Browse Popular Code Answers by Language