SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cannot use string offset as an array in

    Hi,

    I get this error and I can't seem to find why...

    Cannot use string offset as an array in...
    PHP Code:

    class Bar
    {

      protected 
    $foo;

      public function 
    boo($id)
      {

         
    $this->foo['path']['to'][$id]  = '';//line which triggers the error
         
    $this->foo['path']['to'][$id] .= 'string';
         
         return 
    $this;

      }


    Could someone tell what is wrong?

    Thanks in advance.

    Regards,

    -jj.

  2. #2
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jjshell View Post
    Hi,

    I get this error and I can't seem to find why...



    PHP Code:

    class Bar
    {

      protected 
    $foo;

      public function 
    boo($id)
      {

         
    $this->foo['path']['to'][$id]  = '';//line which triggers the error
         
    $this->foo['path']['to'][$id] .= 'string';
         
         return 
    $this;

      }


    Could someone tell what is wrong?

    Thanks in advance.

    Regards,

    -jj.
    protected $foo = array();
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  3. #3
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply but... No change...

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to provide a minimal snippit which demonstrates your problem. The code you posted cannot produce such an error.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •