php array like a struct

Posted on 2014-07-16
Last Modified: 2014-07-21

I need to create an equivalent to a struct in php

my array looks like this:

$employee = array(
		'name' 	=> "",
		'id' 	=> 0,
		'projects' => 0,
		'ontime' => 0,
		'ahead' => 0,
		'overdue' => 0

Open in new window

how can I make an array of employee?
Question by:cycledude
    LVL 21

    Assisted Solution

    by:Randy Poole

    Open in new window

    But you would probably want to create an employee class instead

    Author Comment

    hi, thanks..

    how would it work with a class?

    Author Comment


    I get this when I try it

    Fatal error: Call to undefined function push()

    I am running on a wamp server on local machine, do i need to load a specific module?

    Accepted Solution

    array_push($employees,$employee) worked a treat ;o)

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    A colleague recently asked me about how to give his client a small part of the web site that could be completely under the client's control.  Since I have done this sort of thing before to add emergency banners to a web site, I decided I would creat…
    Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
    The viewer will learn how to dynamically set the form action using jQuery.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now