/    Sign up×
Community /Pin to ProfileBookmark

Basic Class problem

Hey guys,

Right here is my problem, This is so basic I really don’t know why it is not working!

Here is my code:

[code=php]<?php
class ShopProduct{
public $title = ‘Default product name’;
public $producerMainName = ‘main name’;
public $producerFirstName = ‘first name’;
public $price = 0;
}

$product1 = new ShopProduct();
echo $product1->title;
?>[/code]

And all that is outputted is:

[code=php]title; ?>[/code]

Why??? I’m confused

Thanks in advanced!

Rich Hawkes

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@DexterMorganApr 04.2011 — Hi,

Are you sure you are not having the same problem as this thread:

http://www.webdeveloper.com/forum/showthread.php?t=243807

I get the same results as what you say when I tested it using the file:// method
Copy linkTweet thisAlerts:
@RJhawkesauthorApr 04.2011 — Ohh exact same problem I didn't realize I had to upload it to my 127.0.0.1 thanks!
×

Success!

Help @RJhawkes 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.4,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...