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.

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 Compare two xml documents?
Hi all,

I am doing a POC for my project and I am using XE database 10g version.

Generate PDF
Hi guys,

I would like to know if there is a way to generate pdf when clicking on a link. In f

Procedure with variable number of columns
Hi, I have a procedure that looks like this:

PROCEDURE PROC(p_cursor OUT sys_refcurso

UTL File problem
Hi
I have a file in certain path with the following permissions (The file is a dummy file witho

LOOPing Problem
Hello All!

The following code loops through the data and displays the data accordingly. My p

My query is being run with no results.
I have this.

Code: function DropUser($duser_id, $user_email, $user_username) {

Performance impact of cookies
Hi, I was just wondering what impact there would be in terms of performance if you where to set then

Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to

Gerenate tabel in Php
I whant to generate a tabel takeing data from database like this one so the results to be display on

Unexpected T_Variable ?
Hi all,
I dont really know what I am doing!! I know I'm doing something wrong, and I know its on

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