Site Admin
Site Admin Founder of MeaningArticles
198 Views

PHP Convert Integer to a string Example

Hello Dev.

Converting Integer to a string in php is not that difficult, we can use PHP’s built-in strval() function. This function is fully capable of converting string, Integer and double to a string. The important thing is to remember about this function is it shouldn’t be used with objects and arrays; if used, then this will return the type name.

The Strval Function Syntax

strval( $var )

This function takes one parameter, and that is the numerical value which needs to be converted to string. This function returns the string value as you can see in the below example.

<?php 
    $var = 124.061; 
    echo strval($var); 
?> 

// Result: 124.061

i'm hoping it assist you to, thanks for visit my article if you like my article then proportion together with your friend and social platform.