User Tools

Site Tools


uphp:functions:strval

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

uphp:functions:strval [2017/05/08 14:36]
jeff
uphp:functions:strval [2021/09/13 05:57]
Line 1: Line 1:
-======strval====== 
- 
-<badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge> 
- 
-<html>Return the <b><span style="color:green">string<span style="color:black"></b> equivalent of a <b><span style="color:green">number<span style="color:black"></b></html> 
- 
-====Description==== 
- 
-<well size="sm"> 
-<html> 
-<span style="font-size:125%;color:green">string 
-<span style="color:black">strval ( 
-<span style="color:green">mixed 
-<span style="color:blue">$value 
-<span style="color:black">) 
-</html> 
-</well> 
- 
-Type cast an <html><b><span style="color:green">integer<span style="color:black"></b> or <b><span style="color:green">float<span style="color:black"></b> variable into a <b><span style="color:green">string<span style="color:black"></b> variable</html> 
- 
-====Parameter==== 
- 
-<html><b><span style="color:blue">$value<span style="color:black"></b>:  A <b><span style="color:green">number<span style="color:black"></b> (<b><span style="color:green">int<span style="color:black"></b> or <b><span style="color:green">float<span style="color:black"></b>)</html> 
- 
-====Return Value==== 
- 
-^<html><span style="color:blue"><b>$value<span style="color:black"> TYPE</html>^RETURN VALUE^ 
-|<html><b><span style="color:green">int<span style="color:black"></b> or <b><span style="color:green">float</b></html>|<html><b><span style="color:green">String<span style="color:black"></b> equivalent (this is the main use of this function)</html>| 
-|<html><b><span style="color:green">array</b></html>|<html>Empty <b><span style="color:green">string<span style="color:black"></b></html>| 
-|<html><b><span style="color:green">string</b></html>|<html><b><span style="color:green">String<span style="color:black"></b> (unchanged)</html>| 
- 
-====Examples==== 
- 
-<code php> 
-<pre><? 
-   
-  $i=100; 
-  $str=strval($i); 
-  print("The string value of the integer '".$i."' is '".$str."'\r\n"); 
- 
-  $f=1.55; 
-  $str=strval($f); 
-  print("The string value of the float '".$f."' is '".$str."'\r\n"); 
-   
-  $s="100 dollars" 
-  print("The string value of the string '".$s."' is '".strval($s)."'\r\n"); 
-   
-  $arr1=array();            // empty array 
-  print("strval($arr1)='".strval($arr1)."'\r\n"); 
- 
-  $arr2=array("1","2","3"); // array with values 
-  print("strval($arr2)='".strval($arr2)."'\r\n"); 
- 
-?></pre> 
-</code> 
- 
-The above example will output: 
- 
-<code> 
-The string value of the integer '100' is '100' 
-The string value of the float '1.550000' is '1.550000' 
-The string value of the string '100 dollars' is '100 dollars' 
-strval($arr1)='' 
-strval($arr2)='' 
-</code> 
- 
-====Note==== 
- 
-This function performs no formatting on the returned value. If you are looking for a way to format a numeric value as a <html><b><span style="color:green">string<span style="color:black"></b></html>, please see: 
- 
-[[number_format()]] - Format the <html><b><span style="color:green">number<span style="color:black"></b></html> with the specified number of digits of precision 
- 
-[[print(f)]] - Print a formatted <html><b><span style="color:green">string<span style="color:black"></b></html> to standard output 
- 
-[[sprintf()]] - <html>Format a <b><span style="color:green">string<span style="color:black"></b> using the format specified using the passed parameters and return a <b><span style="color:green">string<span style="color:black"></b></html> 
- 
-[[strftime()]] - Format a Linux timestamp using a format <html><b><span style="color:green">string</b></html> 
- 
-====See Also==== 
- 
-[[intval()]] - <html>Return the <b><span style="color:green">integer<span style="color:black"></b> value of a <b><span style="color:green">number<span style="color:black"></b> or <b><span style="color:green">string<span style="color:black"></b></html> 
- 
-[[floatval()]] - <html>Return the <b><span style="color:green">float<span style="color:black"></b> value of a <b><span style="color:green">number<span style="color:black"></b> or <b><span style="color:green">string<span style="color:black"></b></html> 
- 
-[[is_numeric()]] - <html>Check if a value is numeric (<b><span style="color:green">int<span style="color:black"></b>, <b><span style="color:green">float<span style="color:black"></b> or numeric <b><span style="color:green">string<span style="color:black"></b>)</html> 
- 
-[[uphp:variables|uPHP Variable Types and Limits]] 
  
uphp/functions/strval.txt · Last modified: 2021/09/13 05:57 (external edit)