/    Sign up×
Community /Pin to ProfileBookmark

get and set methods

[COLOR=”Navy”][FONT=”Comic Sans MS”]
Hello every one!

does any one have nay idea that is there any get and set method in php like we have in following C#

public int ProductID
{
get
{
return intProductID;
}
set
{
intProductID=value;
}
}

so does any one have knowldege how to make a class where i write

my code in php like above manner

Hope any one would reply me
[/FONT][/COLOR]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@MrCoderJul 25.2007 — [code=php]
class MyClass
{
private var value;

function get_value()
{
return $this->value;
}

function set_value($value)
{
$this->value = $value;
}
}
[/code]
Copy linkTweet thisAlerts:
@erummirzaauthorJul 26.2007 — [FONT="Comic Sans MS"][COLOR="Navy"]

and how to make object of this class and use these proeprties(get and set)[/COLOR]
[/FONT]
Copy linkTweet thisAlerts:
@NogDogJul 26.2007 — www.php.net/class
[code=php]
$obj = new MyClass();
$obj->set_value('test');
echo $ojb->get_value();
[/code]
×

Success!

Help @erummirza 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.10,
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,
)...