how to get substring of string without using substr() function in php ????

Answer Posted / abhijit sil

Accessing single characters in a string can be achived
using "curly braces"
<?php

$string = 'abcdef';
echo $string{0}; // a
echo $string{3}; // d
echo $string{strlen($string)-1}; // f

?>

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is chrome logger?

563


What are the features of php 7?

508


What is exception handling in php?

1080


Swap two variables value without using third variable in php ?

598


Is empty array php?

547






What is difference between session and cookies in php?

476


What is a trait in php?

578


Why we use get in php?

570


What is difference between required and include in php?

485


What is form submission?

550


How many keywords are there in php?

624


Do you know what is the function mysql_pconnect() usefull for?

506


How many types of array are there in php?

583


What is the content of /etc directory?

566


How to set cookies?

558