php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13772 can't access element[0] af an array
Submitted: 2001-10-20 04:22 UTC Modified: 2001-10-20 04:45 UTC
From: gianpaolo at preciso dot net Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.0.6 OS: debian gnu/linux 2.2
Private report: No CVE-ID: None
 [2001-10-20 04:22 UTC] gianpaolo at preciso dot net
I have an array 
$this->sbx[mch]
wich print_r function give me back so in this way:

Array
(
    [0] => ~*
)


so I have one element. I have a function

give_string($i){
  $value = $this->sbx[mch][$i];
  return ($value);
}

that returns back only values from the second one ( [1], [2] ecc.)
I had to solve this way
function give_string($i){
 if ($i == 0 ){
      $t = each ($this->sbx[mch]);
      $value = $t["value"];
      reset($this->sbx[mch]);
    }
    else {
      $value = $this->sbx[mch][$i];
    }
}

Anyone met this problem?
Thanks and goodbye!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-20 04:45 UTC] derick@php.net
Accessing the first element works just fine. Try asking on the php-general@lists.php.net mailinglist for support.

Derick
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 15 04:01:23 2019 UTC