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

Parse String
I need to parse the string below into three variables. How would I do that?

john + 10/20/2008

Comparing two dates
Hi Guys
I have two dates I want to compare. Below is my current implementation. The problem with

trim function issues
Hi guys, total noob here...

So I've been tinkering around with a html and am using php to em

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

Blogging s/w
heya frndz!!! i want to start a blog.... m looking for a s/w like oscommerce which is thr for e-comm

Database 'Validation'
Hi everyone,
I'm trying to validate the password entered by the user with the password in the dat

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

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

passing an array of objects after submit
How do I do this? This is what I have tried and it is not working.

<form method="

Exporting new records
Trying to figure out the best way to set this up.

People register my site.

Their prof

Problem!
I have another problem, when i run this code i get this error "Parse error: syntax error, unexp

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