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

Echo Tweaking help!
HI. I would like to have the output of the entered variables repeat forever, but it's stopping at th

New Search Engine problem
Hey everyone,

I have a ZIP Code Radius search engine already functional. it displays all of t

my login script page is not working on remote computers
hi my login is working on my computer, but when i tried 2 computers from 2 different locations, they

Quick Syntax Question
Hi folks,

I'm getting the following error: "unexpected T_LNUMBER". I'm trying to b

help with contest script
I would like to code a contest script to my site but i don't know how. Could someone just give me pu

Warning: mysql_num_rows() expects parameter 1
When i add quote at the end of this link
example:http://localhost/articlemania/category.php?cid=3

Giving the below syntax error
Dear Experts,

I have used 2 buttons in gui status as display and cjhange.When the user wi

Default TimeZone
The server I'm working with is hosted in America so all times inserted into the database are coming

php form help
Hey,

I use a control file to set my meta tags and titles

Here's an example
Code: &a

Streaming local file from PHP while it’s been written to by a CURL process
I am creating a simple Proxy server for my website. Why I am not using mod_proxy and mod_cache is a

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