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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gianpaolo at preciso dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 01:01:28 2025 UTC