php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46345 String to integer conversion
Submitted: 2008-10-20 11:44 UTC Modified: 2008-10-20 11:48 UTC
From: paul dot guhl at mayflower dot de Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2.6 OS: any
Private report: No CVE-ID: None
 [2008-10-20 11:44 UTC] paul dot guhl at mayflower dot de
Description:
------------
Error occurs while implicit string to integer conversion, which should be performed by the prefix incermention. The ++ operator takes the input string as such and... "increments" the last character of the string. Error faced with PHP 5.2.0, 5.2.3 and 5.2.6. The test case was inspired by the Zend Certification Book :)

Reproduce code:
---------------
$a = 'Test';
echo ++$a;

Expected result:
----------------
1

Actual result:
--------------
Tesu

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-20 11:48 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Sorry, this is expected (and documented at http://no.php.net/manual/en/language.operators.increment.php)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 22:01:28 2024 UTC