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

Update data to upper case in parent/child tables
Hi Gurus!

In production we have a product table and which is being reference by many tabl

$variable $variables type question
I need to be able to designate an array element dynamically, so I thought to use a variable variable

Is it possible to view php source code??
Hi All

I was just wondering if it's possible to view a websites php source code?
I know

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

mysql_query returning boolean instead of mysql ressource
Hi,

I seem to have a weird issue with the php command mysql_query. I pass 2 arguments the que

Inserting Data into a MS Access DB using PHP.
As part of my uni course I am doing a placement at a company whom want me to create a client zone fo

Keeping data in form
How can I keep whatever I write in the form?

Reading waves
Hi,

I am trying to find a way of finding the highs and lows on a graph line, the line points

value not going in data base
hello friends....
i am having a working javascript....when i am selecting any

Problem executing bash script using shell_exec
Hi there,
I created a bash script file using following code to convert doc documents to pdf using

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