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

Count number of records in all the tables with a querry URGENT PLEASE...
I downloaded ORACLE 9I DATA DUMP into my comp. There are number of tables. I need to find out the

How do I replace any number of character occurences with one occurrence?
How do I replace any number of character occurences with one occurrence?

Let's say I have:

How to secure my login data to my database?
Hi there,

It may be a stupid question but I don't know how to secure my login data to my data

TCP Sending Unsigned Char...
Hi...

I want to send over tcp/ip some data, i have the data in hexadecimal, and when i tr

Help With Showing Users On the Index Page
Ive got this code which works just how i want it to.

Code: <?
$timenow=time();

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

getting most records by count
Code: [Select]<?php

$connect = mysql_connect("localhost","dam

How to schedule the a job?
Hi,
I have prepared a task ( i.e. a procedure is prepare the file and send the same to con

Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_

Material xxx does not exist in plant xxx
Dear All,

I am working for a steel project which is repetitive manufacturing.

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