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

PHP Array quick help
I need

$_SESSION{'username'} to be like this:


if $_SESSION['username'] = "gay

IS this code correct
The reason i ask is everything underneath it appears to be alink as well, tis blimmin annoying

To add a field on the screen XK02.
Hi All,

How to add an additional field in the vendor change control screen XK02.
The

A WBS element with the name XXX already exists in version FREI_VERSION
Hi.
When I am trying to insert WBS element in a project, error occurs:

"A WBS eleme

Get to know your fellow coder
I think it's time we got personal around here. There's a lot of code swapping and a few members kno

Different actions for different parts of a string
<?php
function dosomething($string, $else = '') {
if (empty($else))
$string

Help with email validation please...
Hi,
Please could you help.
I have a register.php login page where users register, the detail

Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so

PHP Include not working
The website is http://www.grlistingservices.com

The code block is as follows:

<

Deleting a record php
Attempting to setup delete a record page. The below code I put together doesn't seem to work.

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