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

Is this possible? If one file assigned to an ID...
I have a page that lists property listings assigned to a specific user (a manage page), with brief t

Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The

generating random codes
Hi guys n gals,

I have a requirement to generate 250,000 unique codes...

These codes a

simple php table loop
Hi all,

I've the following code

<?php // Create category options

Anti Spam Code Problems
Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I

Supress some serveroutput but not all
Hi,

I have a script I'm working on that uses plsql to create and RMAN script, this uses d

single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w

How can use this array as a key?
Say I have this array for example:


print_r($array);

Prints:
Code: [Select]Array

Mail Script Problems
I have created a PHP mail script. I am having a problem though. In $body i am trying to put two va

newbie error
what is wrong with this code ?

<html>
<body>

<?

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