|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-27 23:42 UTC] gschlossnagle@php.net
[2010-12-20 11:50 UTC] jani@php.net
-Package: Tidy
+Package: Scripting Engine problem
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Mar 27 10:00:02 2026 UTC |
Description: ------------ This may not be a bug, but I would assume with the change in PHP5 (from PHP4) where character access in strings is now done using array operators that count('anystring') would return the length of the string (being the number of array items in the string). I don't see any official documentation on the reasoning for moving to array access operators with strings in PHP5, but I've seen a number of reports that it was for the movement of treating strings as arrays. tierra@ibaku tierra $ php -v PHP 5.0.3 (cli) (built: Dec 21 2004 20:37:03) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies tierra@ibaku tierra $ php count.php count('string') returns: 1 tierra@ibaku tierra $ uname -a Linux ibaku 2.4.27-linode36-3um #1 Fri Oct 29 00:59:10 EDT 2004 i686 UML User Mode Linux GNU/Linux PHP Version => 5.0.3 System => Linux ibaku 2.4.27-linode36-3um #1 Fri Oct 29 00:59:10 EDT 2004 i686 Build Date => Dec 21 2004 20:26:48 Configure Command => './configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var /lib' '--disable-cgi' '--enable-cli' '--enable-embed' '--with-config-file-path=/etc/php/cli-php5' '--disable-bcmath' '--without-bz2' '--disable-calendar' '--without-cpdflib' '--disable-ctype' '--wi th-curl' '--without-curlwrappers' '--disable-dbase' '--disable-dio' '--disable-exif' '--without-fam' '--without-fbsql' '--without-fdftk' '--disable-filepro' '--disable-ftp' '--with-gettext' '--with out-gmp' '--without-hwapi' '--without-iconv' '--without-informix' '--without-ingres' '--without-interbase' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--without-mcve' '--disable-memor y-limit' '--without-mhash' '--without-mime-magic' '--without-ming' '--without-mnogosearch' '--without-msql' '--without-mssql' '--with-ncurses' '--without-oci8' '--without-oracle' '--with-openssl' ' --with-openssl-dir=/usr' '--without-ovrimos' '--disable-pcntl' '--without-pfpro' '--without-pgsql' '--disable-posix' '--with-pspell' '--without-recode' '--disable-shmop' '--without-snmp' '--disable -soap' '--disable-sockets' '--disable-spl' '--without-sybase' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--without-tidy' '--disable-tokenizer' '--disable-wdd x' '--with-xsl' '--with-xmlrpc' '--disable-yp' '--with-zlib' '--disable-debug' '--without-cdb' '--with-db4' '--without-dbm' '--without-flatfile' '--with-gdbm' '--without-inifile' '--without-qdbm' ' --with-jpeg-dir=/usr' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--with-ttf=/usr' '--enable-gd-jis-conf' '--enable-gd-native-ttf' '--with-png-dir=/usr' '--with-tiff-dir=/usr' '--without-xpm-di r' '--with-gd' '--with-imap' '--with-imap-ssl' '--with-mysql' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--without-mm' '--without-msession' '--enable-sqlite-utf8' '--enable-dba' '--with-readl ine' '--without-libedit' Reproduce code: --------------- <?php echo "count('string') returns: " . count('string') . "\n"; ?> Expected result: ---------------- count('string') returns: 6 Actual result: -------------- count('string') returns: 1