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

Help building / using array
First - this is a cross-posting, if this is wrong I apologise! What started out as a MySQL query que

Am i doing this wrong?
Im pulling from an Oracle database some info... one of which is a field count_pnums which is a NUMBE

CODE NOT WORKING
Code: [Select]<?php
//include shared codes

include '../lib/common.php';
include

Count of reciepients in php mailer
How can i sent a mail to large no of reciepients say 10,00,00 Using PHP MAILER

Operator precedence assistance.
I did a quick Google search and couldn't quite find the answer I wanted in terms I could understand,

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

Cannot Display Array from Select Statement + Login question
Hi,
I'm new to PHP but so far so goog. I was assigend a project and I'm very close to completion.

Error in SQL Syntax HELP!!!
I have this page:

Code: <?php

session_start();

//connect to server and s

query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:

Code: [Select]$query

IF Statement & Two Tables With Different Echoes
I'm retrieving two tables in a single query using UNION ALL, like so:

Code: $query = "SE

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