Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Explain do you use composer? If yes, what benefits have you found in it?

937


What is session_register()?

953


What is csrf token and how will you add csrf token in ajax?

921


Tell me how to create a session? How to set a value in session? How to remove data from a session?

941


Differences between get and post methods?

980


What is difference between mysql_connect and mysqli_connect?

967


What does namespace mean in php?

1001


How to terminate the execution of a script in PHP?

1007


How variables are passed through arguments?

905


How to execute an sql query? How to fetch its result?

1058


What is the use of $_server and $_env?

1006


What is faster in php?

1018


Tell me how can we check the value of a given variable is alphanumeric?

994


Is polymorphism inherited?

956


Why do we use interface in php?

931