php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3399 postfix increment operator (++) fails to cast string to integer
Submitted: 2000-02-03 22:44 UTC Modified: 2000-08-05 12:45 UTC
From: athompso at commerced dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.12 OS: Solaris
Private report: No CVE-ID: None
 [2000-02-03 22:44 UTC] athompso at commerced dot com
Test case:

$i = '-1';
$i++;
echo "i = $i\ntype = " . gettype($i) . "\n";

Output:
    i=-2            (****questionable behaviour****)
    type=string            (****questionable behaviour****)


Reference Case:

$i = '-1';
$i--;
echo "i = $i\ntype = " . gettype($i) . "\n";

Output:
    i=-2
    type=integer

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-02-06 06:28 UTC] sas at cvs dot php dot net
Reclassifying
 [2000-08-05 05:50 UTC] hholzgra@php.net
this still occures with latest php 3 & 4
 [2000-08-05 12:45 UTC] stas@php.net
This is Perl-style "smart increment". It is intended to be so.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 17:01:30 2024 UTC