/    Sign up×
Community /Pin to ProfileBookmark

Let’s say I have an object called Keyword and it looks like so

[code=php]
class keyword
{
var $field;
var $prefix;
}
[/code]

and I also have an object called query which contains a keyword object. How would i define the keyword object in the query class?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@JDM71488Jul 29.2005 — it sounds like you want to nest those objects like query > keyword, is that right? im not one for oop in php, but will this help?

http://us2.php.net/oop

if not, then please give more info...
Copy linkTweet thisAlerts:
@Stephen_PhilbinJul 29.2005 — Which PHP are you using? OOP in PHP4 is very different from OOP in PHP5.

If you're using 5, then you can use the constructor to instantiate another class as a member of the class that is currently being instantiated.
×

Success!

Help @Crushin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...