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.

Read Also:  PHP Conditional Statements Example

function return string in array php

php return array

<!--?php </p>
<p>function product() {<br ?--> $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

Example

<!--?php $results = 32.360; echo strval($results); ?-->

I hope you get an idea about php function return string.
I would like to have feedback on my infinityknow.com 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.