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

error checking breaking my code
Hi there, OK first of all, big apologies for what I assume is really fundamental errors in the struc

How can I get my program to read a larger array ??
Hi:

I have this program that reads from an array to do calculations. The array are just t

New Search Engine problem
Hey everyone,

I have a ZIP Code Radius search engine already functional. it displays all of t

Odd or Even
Inside of a while loop I need to echo several rows of info...easy enough.

In the loop (for th

no idea what to do...
I'm fed up. I had issues with code that I have working on a different site that didn't work on my cu

Why do I get this error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a5488351/public_html/b

PHP and MySQL on intranet?
Is it possible to use both these on an intranet network?

Thread in PHP
Thread in PHP
Some basic use and basic code for thread in php
This is my question?

How to implement HTTP connection timeout
Hi All,I would like to implement an HTTP connection timeout.

I am working on a application wh

Display the user's weight lost in the past week
Hello everyone,

I am working on a weight loss app for my site, and I want to display the user

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