First Method


<?php

$string= "Hello World";

$string_new= $string&#91;0&#93;;

echo $string_new;//output H 

?>

Second Method


<?php

$string= "Hello World";

$string_new= substr($string,0,2)

echo $string_new;//output He

?>


1 Comment

shramika02 · August 7, 2020 at 1:29 pm

Grate post. Thank You for sharing useful information.
https://www.technobridge.in/php-training-course.php

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *