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

ScriptManager History and Opera Issue
I am having an issue in opera with the ScriptManager. I have a ScriptManager on a page with history

Delete all files in folder except with certain name
I have a script that I want to delete all files in a folder (taken from a database) except for one n

form variables from database help.
Hi all,

I would like to have a form that gives you options based on the results of an mysql q

mr8m - reverse document
Friends,

I'm trying to reverse a document held by MIRO, but it reports the message balan

Email logic not working
I would like to send an email using the php email() function then if it does execute i.e sends i wou

with clause
hi all, i have a big query that usually access the same table more than once. for example, i have s

PHP submit form script causing blank page
Im trying to submit a form using this script, however nothing shows up on the page, does anyone know

need help modifying script
Hi guys,

I'm fairly new to php and am having a bit of trouble modifying a script.

This

Set Categories
I am creating a submission form for somebody to come in and submit products. These products are sep

PHP FTP connect doesn't work with correct login
Hi!

i am working on this test code:
Quote<?php

$ftp_ser

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