Если выполнить скрипт
<?php
$x=1.42;
echo "x= ".$x;
echo "<br/>";
echo ($x>1.45)?"grater then 1.45":"not greater then 1.45";
echo "<br/>";
$x+=0.43;
echo "x= ".$x;
echo "<br/>";
echo number_format(1.60,2,'.', '');
echo "<br/>";
echo ($x>1.45)?"grater then 1.45":"not greater then 1.45";
на php под openwrt, запущенный на виртуальном роутере/машине mikrotik metarouter, где используется приведения float к string выводится не понятная фигня, если под windows все ок. В чем может быть проблема? Возможности попробовать не под виртуалкой openwrt нет.
На Windows все конечно ок:
x= 1.42
not greater then 1.45
x= 1.85
1.60
grater then 1.45
На OpenWRT инопланетные символы:
x= -0
not greater then 1.45
x= -8.2:244943496E-185
-0.00
grater then 1.45
функция, например, round($x) вешает намертво скрипт..
еще примеры вывода float:
-O.1@88931@376E-185
P.268721C9656E-78
P.268721C9656E-78
B.91L53:75674E-60
PHP Version 5.2.6
System Linux OpenWrt 2.6.27.21 #6 Thu Dec 10 13:10:10 EET 2009 mips
Build Date Dec 9 2009 08:46:50
Configure Command './configure' '--target=mips-openwrt-linux' '--host=mips-openwrt-linux' '--build=i386-redhat-linux' '--program-prefix=' '--program-suffix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--sysconfdir=/etc' '--datadir=/usr/share' '--localstatedir=/var' '--mandir=/usr/man' '--infodir=/usr/info' '--disable-nls' '--disable-ipv6' '--enable-shared' '--disable-static' '--disable-rpath' '--disable-debug' '--without-pear' '--with-config-file-path=/etc' '--enable-magic-quotes' '--enable-memory-limit' '--disable-short-tags' '--disable-ctype' '--disable-dom' '--enable-ftp=shared' '--without-gettext' '--without-iconv' '--disable-libxml' '--without-libxml-dir' '--disable-xmlreader' '--disable-xmlwriter' '--disable-mbstring' '--disable-mbregex' '--with-openssl=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-kerberos=no' '--with-openssl-dir=/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--enable-session=shared' '--disable-simplexml' '--disable-soap' '--enable-sockets=shared' '--disable-tokenizer' '--with-zlib=/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-zlib-dir=/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--disable-filter' '--with-curl=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-gd=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--without-freetype-dir' '--with-jpeg-dir=/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-png-dir=/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--without-xpm-dir' '--without-ttf' '--without-t1lib' '--enable-gd-native-ttf' '--disable-gd-jis-conv' '--with-gmp=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-ldap=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-ldap-sasl=/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-mysql=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--disable-spl' '--with-pcre-regex=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-pgsql=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-sqlite=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--enable-pdo=shared' '--with-pdo-sqlite=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--enable-xml=shared,/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--with-libexpat-dir=/home/nik/OpenWRT/trunk/staging_dir/target-mips_uClibc-0.9.30.1/usr' '--enable-apc' '--disable-apc-mmap' '--disable-apc-pthreadmutex' '--enable-exif' '--disable-cli' '--enable-cgi' '--disable-fastcgi' '--enable-force-cgi-redirect' '--enable-discard-path'