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 do you use composer? If yes, what benefits have you found in it?
What is session_register()?
What is csrf token and how will you add csrf token in ajax?
Tell me how to create a session? How to set a value in session? How to remove data from a session?
Differences between get and post methods?
What is difference between mysql_connect and mysqli_connect?
What does namespace mean in php?
How to terminate the execution of a script in PHP?
How variables are passed through arguments?
How to execute an sql query? How to fetch its result?
What is the use of $_server and $_env?
What is faster in php?
Tell me how can we check the value of a given variable is alphanumeric?
Is polymorphism inherited?
Why do we use interface in php?