Leveraging standard class objects


show more Leveraging standard class objects provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP show less
please wait ...

Leveraging standard class objects

In this chapter, I'm going to explore built-in PHP objects. I'll start with the standard class, which is pretty generic, then demonstrate how to get objects from the database. We'll handle errors in an object-oriented way, then customize them to meet our needs. Let's start with the standard class. A standard class is a generic class that can be created by typecasting a value as an object, like casting the string "hello, world" as an object. It won't have any methods, but it will have values. In case you were wondering, if you typecast an object to an object, that's kind of goofy, and nothing will happen.

If you typecast that array to an object, the result will be an object with properties named for the keys to the array, with values corresponding to the array values. Let's clean up the demo, and remove the cloning tests. Create a test standard class object out of a nested array. Echo <h2> Testing typecasting to an object>. $test_object = (obje...

Leveraging standard class objects
Video duration: 2m 42s 1h 57m Intermediate Updated Apr 10, 2013

Viewers:

Leveraging standard class objects provides you with in-depth training on Developer. Taught by Jon Peck as part of the Object-Oriented Programming with PHP

Subject:
Developer
Software:
PHP
Author:
please wait ...