Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7522467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:31:51+00:00 2026-05-30T02:31:51+00:00

I am creating a notification class which uses the session to store messages. I

  • 0

I am creating a notification class which uses the session to store messages. I need to create them as a multidimensional array, so I can take advantage of different ‘namespaces’, so as to keep messages from displaying on the wrong pages.

Here is an example:

print_r($_SESSION)
Array
(
    [EVENT_CMS] => Array
    (
        [Notifier] => Array
        (
            [0] => 'Your settings have been saved.'
            [1] => 'You must re-upload...'
        )
    )
)

Now on the settings page, these messages will print with a call to the proper method.

I am having trouble setting up the message container within the class. This is what my constructor looks like:

public function __construct($namespace = 'Notifier') {
    $this->_session_start();

    if(defined('SESSION_NAMESPACE')){
        $this->notifications =& $_SESSION[SESSION_NAMESPACE][$namespace];
    } else {
        $this->notifications =& $_SESSION[$namespace];
    }
}

(The SESSION_NAMESPACE constant is defined, so the true block is executed.)

$Notify = new Notifier();
$Notify->add($_GET['test']);

print_r($_SESSION);

The above code yields me this array:

$_SESSION
Array
(
    [EVENT_CMS] => Array
    (
        [Notifier] => 1
    )

)

The add message method should update the session, right? Since the notifications array is a reference? The call to update_session() has no effect on the output…

public function add($message, $class = NULL) {
    $message_node = $message;
    $this->notifications[] = $message_node;

    $this->update_session();
}

public function update_session(){
    $this->SESSION[$this->namespace] &= $this->notifications;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:31:52+00:00Added an answer on May 30, 2026 at 2:31 am

    You are mixing up the bitwise operator with the reference operator. The wrong one is used in your update_session() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a notification which fires an Intent. Here a really shortened excerpt of
I have developing an App where the user can create event and set notification
I have a notification app, which is creating notification when sms message is received.
I'm creating a Notification table, with the following specification: CREATE TABLE [Notification] ( [NotificationId]
As far as I know we can create notifications in Android using Notification Manager
I'm creating a notification with something similar to the following: Intent ni = new
I am creating a firefox extension that should give a notification when the user
Creating a google map with store locations within 50 miles of user entered address.
I am going to be creating an application which will monitor a folder, which
I have an object that can take anywhere from a split second to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.