php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60525 Array Index can automatically covert integer.
Submitted: 2011-12-14 14:52 UTC Modified: 2011-12-14 15:05 UTC
From: 353880028 at qq dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.0RC3 OS: All
Private report: No CVE-ID: None
 [2011-12-14 14:52 UTC] 353880028 at qq dot com
Description:
------------
<?php
$test = array("fruit"=>"apple");
echo $test["fruit"]["like"];

//the result is "a"
//why? I think it should be notice that index is not found but intval("like")


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-14 15:05 UTC] laruence@php.net
-Status: Open +Status: Bogus
 [2011-12-14 15:05 UTC] laruence@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

since $test["fruit"] is a string not a array,  so same as $string["***"] => 
$string[0].
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 05:01:34 2025 UTC