Answers for "how to echo a part of string php"

PHP
2

php string take part

<?php
$str = "Africa Beautiful!";
echo substr($str, 0, 6);  // Outputs: Africa
echo substr($str, 0, -10); // Outputs: Beautiful
echo substr($str, 0);     // Outputs: Africa Beautiful!
?>
Posted by: Guest on May-23-2021

Code answers related to "how to echo a part of string php"

Browse Popular Code Answers by Language