How to get last character of a string in PHP?
by
Anuj Kumar
How to get last character of a string in PHP? The substr() function returns a part of a string.
Syntax
<?php
$string="Welcome to PHPGURUKUL";
echo substr($string,-1);
?>
OUTPUT:
L
Tags: How to get last character of a string in PHP
Anuj Kumar
Hi, I’m Anuj Kumar, a passionate web developer with expertise in PHP, Laravel, CodeIgniter, MySQL, and Bootstrap. I enjoy building clean, responsive, and scalable web applications that address real-world challenges.
I love creating student-friendly projects, sharing practical coding tips, and helping developers—especially beginners—strengthen their skills. Through this website, my goal is to simplify complex concepts, offer ready-to-use project solutions, and support the developer community with useful, hands-on resources.
You may also like...