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

update sql when refresh - php
hi
I have made a table (attachement)

the users can update the sql database using + or x bu

Login Script Issues
I am using a script I got from http://phpsense.com/php/php-login-script.html in order to allow peopl

Get dump of MySQL DB from Live Site
I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server.

Looping Problem
I've got a client that has a database with about 200 events at any given time. I'm trying to loop t

str_replace help
Hey there,

I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean

using file_get_contents??
okay how would i create a script using file_get_contents() in php have it grab search pages 1-20 and

php call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d

login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php

Structure Question - One Table or One Table Per Record Set?
I have a web app (mySQL and PHP) which allows people to create an item with up to 200 records which

Multiple websites question.
Hi, does php have any functionality that enables a programmer to extract information from a website

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