php function return string – Create a PHP Function With Multiple Returns

php function return string – The strval() function is an inbuilt function in PHP as well as substr() Return part of a string or strval() is used to convert any scalar value (string, integer, or double) to a string.

php function return string

PHP function: substr or strval— Return part of a string. To return a value, you will use the return keyword inside of your function.

function return string in array php

php return array

 $result[0] = "virat";
$result[1] = "rohit";
$result[2] = "dinesh";
return $result;

$product = product();
foreach($product as $rows){
echo $rows;

Don’t Miss : Php string replace multiple

return string value in php

php int to string

$number = 25;

echo strval($number);

echo (String) $number;
// Results
// "25"
// "25"

PHP – strval() Function


I hope you get an idea about php function return string.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment