PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 10th, 2002, 07:56 AM
ssharma1 ssharma1 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Atlanta
Posts: 1 ssharma1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to ssharma1 Send a message via AIM to ssharma1 Send a message via Yahoo to ssharma1
Unhappy PHP coding

How can I design a Class In PHP, called Person, containing name, ssn, birthdate, and address as data members. Also, give a statement that will declare and initialize a Person object called Joe with the following name = “Joe Doe”, ssn = “123-12-1234”, birthdate= 01/30/1990 and address = “123 Tara blv., Atl., GA 30303”.

Reply With Quote
  #2  
Old December 30th, 2003, 10:31 PM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
PHP Code:
<pre>
<?
php

class Person
{
  var 
$name "";
  var 
$ssn "";
  var 
$birthdate "";
  var 
$address "";

  function 
Person($n='',$s='',$b='',$a='')
  {
    
$this->name $n;
    
$this->ssn $s;
    
$this->birthdate $b;
    
$this->address $a;
  }
}

$name "Joe Doe";
$ssn "123-12-1234";
$birthdate"01/30/199";
$address "123 Tara blv., Atl., GA 30303";

$person = new Person($name,$ssn,$birthdate,$address);
var_dump($person);

?>
</pre> 
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP coding


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT