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

Tracking Unique Clicks
Hi guys and gals,

Basically I have a database which tracks clicks on my outbound links, I do

Motivational Posters
Hello,

I wonder how can i do them in php. Are there any sample codes that you can show me?

Undefined variables
hi
----------------------------------------------------------------------------------------------

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

show random images
hey guys

can someone please suggest a way in which the following code can be edited so it onl

str_replace help
I am thinking str_replace is my only option to filter outputs from my database to convert them to sa

Embed Video Problem
Hey, thanks for looking!

File to be embedded:

Code: <playlist version="1&q

Function to extract email attachments using PHP IMAP
function extract_attachments($connection, $message_number) {

$attachments = array();

Problem with PHP code- simple contact form
Hi Folks,
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a co

error help - Dynamic Image
I've been working on making my site less cluttered in the directories and more secure lately. In an

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