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

making web pages for accounts
Hello, I would like to make pages for accounts on my website im making (its not a real website..im j

Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav

mysql VARCHAR acting like INT
Hi, All.

I have a table that contains a varchar(10) column named weird_field. In this column

Data Function is Its Not working IN IE8
This is my first time to use formums. I hope i can get solution for this problem. view plaincopy to

Functions Not Loading Into Div
I had some help doing some of this but what I'm trying to do is get my functions to retrieve its val

how to hide input fields on selection screen using variant attribute
Hello all,

I want to know how to hide input fields on selection screen using variant attr

php code generators
All

Whilst enjoying learning a new language i have come accross a number of free code generat

Find current logon time
Hi,
in my sql script i want to query and find out the logon time of the current session.
<

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

Multi image upload
I have a gallery to build and want to build a dynamic upload form to allow for $var number of fields

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