Object-Oriented Programming with PHP Demo

Instantiating Address

Empty Address

Address::__set_state(array(
   'street_address_1' => NULL,
   'street_address_2' => NULL,
   'city_name' => NULL,
   'subdivision_name' => NULL,
   '_postal_code' => NULL,
   'country_name' => NULL,
   '_address_id' => NULL,
   '_address_type_id' => NULL,
   '_time_created' => 1714717031,
   '_time_updated' => NULL,
))

Setting properties...

Address::__set_state(array(
   'street_address_1' => '555 Fake Street',
   'street_address_2' => NULL,
   'city_name' => 'Townsville',
   'subdivision_name' => 'State',
   '_postal_code' => NULL,
   'country_name' => 'United States of America',
   '_address_id' => NULL,
   '_address_type_id' => 1,
   '_time_created' => 1714717031,
   '_time_updated' => NULL,
   'postal_code' => '12345',
))

Displaying address...

555 Fake Street
Townsville, State 12345
United States of America

Testing magic __get and __set

555 Fake Street
Townsville, State LOOKUP
United States of America

Testing Address __construct with an array

123 Phony Ave
Villageland, Region 67890
Canada

Address __toString

123 Phony Ave
Villageland, Region 67890
Canada

Displaying address types...

array (
  1 => 'Residence',
  2 => 'Business',
  3 => 'Park',
)

Testing address type ID validation

0: Invalid
1: Valid
2: Valid
3: Valid
4: Invalid