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 web developer skilled in PHP, Laravel, CodeIgniter, MySQL, and Bootstrap. I love creating student-focused projects and sharing coding tips to help developers build real-world solutions with ease.
I specialize in building clean, responsive, and scalable web applications that solve real-world problems. I enjoy working on student-friendly project ideas, sharing coding tips, and helping beginners grow their development skills.
Through this website, I aim to simplify complex concepts, provide ready-to-use project solutions, and support the developer community with practical resources.
You may also like...