1

I want to create a multidimensional array through class object. Don't know the syntax. Kindly guide me regarding that.

class gridcell {
    var $place;
    var $latitude;

    $spatial=array();
    $temporal=array();
    $taxi=array();


    $raiwind = new gridell();
    $raiwind->place("raiwind");
    $raiwind->latitude("31.4279");

Now I wanted to put the following array in the $raiwind->$spatial
What would be its synatx. Different objects have different elements in $spatial array.

spatial(
    array(
        array(
            'lda',
            '31.4104',
            3
        ),
        array(
            'ali',
            '31.3998',
            3
        ),
        array(
            'multan',
            '31.4675',
            10
        )
    )
);
2
  • So, what is the problem? Commented Apr 16, 2014 at 9:41
  • $raiwind->spatial = array(...); Commented Apr 16, 2014 at 9:42

1 Answer 1

1

Simple as this:

$raiwind->spatial[] = array(
  array('lda','31.4104',3),
  array('ali','31.3998',3),
  array('multan','31.4675',10)
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.