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

How can I get my program to read a larger array ??
Hi:

I have this program that reads from an array to do calculations. The array are just t

Help uploading .JPG
I have a problem with upload images when the ending is .JPG capitalized.. I really don't know what c

Update not working ... please help
Hi,

I am trying to update a row using an edit form by passing id of the row .. but it is not

Embed Video Problem
Hey, thanks for looking!

File to be embedded:

Code: <playlist version="1&q

links using header()
Hi All

I'm not sure where to ask for help on this but I hope someone can offer some. I'm at

Is it a good practice to store user info. in sessions?
I am making a user class for my script which stores all the user information in sessions. It takes u

Solution to the FindControl problem
I have seen may posts about having problems with the FindControl method. Most seem to come about bec

A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the

echo $rows help
Hi all,

Hopefully something simple that I don't know!

I have this:

Code: [Selec

Is it possible to stop reservation creation in PM Order?
Hi All,

Is it possible to stop reservation creation in PM Order?

Thanks in adv

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