Array becomes unset by itself?


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I have a bit of experience with PHP but not extensive. It seems I cannot store any items to the array $details.

Did you know?Explore Trending and Topic pages for more stories like this.
The class:

class Newsletter {
public $details = array();

function Newsletter($id) {
$details['id'] = $id;
echo "From same function: " . $details['id'];

$this->Load();
}

function Load() {
echo "From sibling function: " . $details['id'];
}
}

The call from the webpage:

$x = new Newsletter(123);
//output
From same function: 123
From sibling function:

Is there a special way to interact with the array so that it sticks for use with other functions?

Thanks
No comments posted yet

Your Answer:

Login to answer
217 Like 20 Dislike
Previous forums Next forums
Other forums

Somebody hacked into my site and changed coding >>> URGENT HELP NEEDED <<<
I am not that much into programming , but somebody is hacking to my site and injecting some kind of

problem in program for counting no of chars using pointers
Hi all, I was trying to make a program which counts number of chars in a string using concpt of poin

restricting another login once you logout
Hello,

how can I restrict a page from login authenticating against info in a MySQL DB for a s

I have a parse error in this query help..
Code: $query1="INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES

big pagination problem in php
<?php

$connect = mysql_connect("localhost", "root", "")

Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue.

I have a banner s

wav to mp3 + goDaddy
I need to convert wav files to mp3s. From what I have found so far one way to do it is to have my PH

URL Rewrite issue
Im created a series of Rewrites and on page checks to make sure the correct url is being called. But

Filename and Line Number Custom Error
I have a class, with a method that accepts 2 parameters. I would like to output error messages.

str_replace help
I am thinking str_replace is my only option to filter outputs from my database to convert them to sa

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash