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 are the advantages of php?

534


List types of array are available in php?

552


What is difference between action hook and filter hook?

493


Do I need to install php after xampp?

536


How to run the interactive php shell from the command line interface?

528






What does pear stand for?

534


Which php global variable is used for uploading a file?

509


What are the different tables(engine) present in mysql, which one is default?

515


What is csrf verification?

532


How to change the principal password?

621


How are cookies created?

546


Explain the differences between get and post methods?

497


Why php is used in html?

527


What is echo in html?

499


Which is better php or wordpress?

518