git.cweiske.de
/
paste
/
645.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a21f7dc
)
(no commit message)
master
author
Christian Weiske
<cweiske@cweiske.de>
Tue, 29 Oct 2019 10:53:43 +0000
(11:53 +0100)
committer
www-cweiske
<www-cweiske@ahso3>
Tue, 29 Oct 2019 10:53:43 +0000
(11:53 +0100)
safefloatstr.php
[new file with mode: 0644]
patch
|
blob
diff --git a/safefloatstr.php
b/safefloatstr.php
new file mode 100644
(file)
index 0000000..
b58fb74
--- /dev/null
+++ b/
safefloatstr.php
@@ -0,0
+1,18
@@
+<?php
\r
+/**
\r
+ * Cast variable to string.
\r
+ * Floats get converted correctly without locale problems (always a dot)
\r
+ *
\r
+ * @param mixed $value
\r
+ *
\r
+ * @return string
\r
+ */
\r
+function safefloatstr($value)
\r
+{
\r
+ if (is_float($value)) {
\r
+ return var_export($value, true);
\r
+ }
\r
+
\r
+ return (string) $value;
\r
+}
\r
+?>
\ No newline at end of file