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

UDS 4.0 Datatype issue
UDS 4.0.322 -- connecting to NI Labview 9.0

When using connection method: Cache with live

Storing user data help?
Hey Guys,

I'm not use if this question is to broad but I can always give you more informatio

Error Messaging not working
I changed the way my form tells the user of an error. But I can't seem to get it to work properly.

Join Query Help
Hi all,

I am having problems with the below code, which we shall call 'my first join query'!

please hep to get values from a table row
can anyone tel me how I can select and get data from one row by pressing an Edit button in that row

Strange php code found on my website
I got hacked and the following code was placed within my files:

Code: [Select]<?
/*

Price in PR
Dear Experts,
Why we have to enter the price in the PR, and why there is no free goods indicato

Need help Updating SQL Server Express DB from c# :(
Please can anyone help with:-
1 How to sructure the strSelect statement.
2 How to instruct

extract a file from zip file
hi,
i know how to unzip a zip file in php, but is there a way to just extract a certain file only

php mailer
How can i send a mail to large no, say 50,000 reciepients using [color=#0000FF]php mailer[/color]

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