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
Explain how is it possible to set an infinite execution time for php script?
What is the use of dual table in mysql?
What’s the difference between htmlentities() and htmlspecialchars()?
Tell me how to set a page as a home page in a php based site?
Tell me how do you define a constant?
What is call by reference in php?
How to read one character from a file?
Declare a new variable in php equal to the number 3;
Tell me are parent constructors called implicitly inside a class constructor?
Which function parses an English textual date or time into Unix timestamp in PHP.
What is $_ request in php?
How to set cookies in PHP?
What is xss in php?
When do sessions end?
What is the difference between characters 34 and x34?