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

need help to creat database
Hello Team, please guys i am stuck from three days with paypal issue for IPN but no luck yet now i w

Strip Slashes Help
I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and

Issues: PHP Forms -Clearing
I've tried looking online before actually asking for help, but I've been looking for about the past

restricting another login once you logout
Hello,

how can I restrict a page from login authenticating against info in a MySQL DB for a s

PL/SQL: ORA-00947: not enough values error message
Hi all i am getting Error(25,63): PL/SQL: ORA-00947: not enough values error message when executing

array help
Does anyone know how to require 10 text fields for individual grades and output class average? (10 p

Need help/w Page: 1,2,3,4 function!
So I have this code im working on where it's ment to display seperate pages having 20 logs each
I

Security Exception on pages using AJAX
I am getting the exception: attempted to perform an operation not allowed by the security policy on

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

Sending UDP Raw socket
I truly need help on this. I am trying to write a test program that simulate a network environment

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