Jump to content

Objects


martin.kahil

Recommended Posts

Hi again, now i need to create some objects for my calennder.. I mean that I have 3 values for every date (at least) in my database. And I want to import it to the page, so I want to refer to it like thisObj.dateObj.value1Obj.value2How do I create something like this? And can I create an array of these?

Link to comment
Share on other sites

Not in my knowledge, I haven't investigated much in that. It might be possible but even if you did, it wouldn't look the way it does in other languages, because PHP doesn't have a . level system.

Link to comment
Share on other sites

He's talking about dot notation for referencing class members. PHP doesn't use dot notation, the member reference operator in PHP is ->. If you want the same sort of functionality in PHP that you get with Javascript objects, then you can use an array for that. Everything in Javascript is an array structure anyway. If you want more then what Javascript allows, with more of a full object-oriented interface, then you can define a class for your object and set up the properties and methods for it. Check these links, depending on the version of PHP you're using:http://www.php.net/manual/en/language.oop.phphttp://www.php.net/manual/en/language.oop5.php

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...