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
How to access a specific character in a string?
What is htaccess in php?
Is php 7.0 stable?
Write down the code for save an uploaded file in php.
What is 'float' property in css?
What is a string in r?
How to convert strings to upper or lower cases?
What is constructor and destructor?
How to find the position of the first occurrence of a substring in a string?
what does this symbol mean in php?
Can you specify the "new line" character in single-quoted strings?
How to declare an array in php?
What is the use of friend function in php?
How to specify argument default values?
How to stop the execution of php script?