Work with PHP Class Methods

Video loading...

Transcript language code: 

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:03
    with Leanna Pelham
  • 0:05
    Arrays and objects have a lot in common.
  • 0:08
    Arrays have keys, while objects have properties, but both store data.
  • 0:13
    Objects have one other big, incredible,
  • 0:16
    mind-blowing advantage-- methods.
  • 0:20
    A method is a fancy word for a function,
  • 0:23
    and we're all comfortable with those.
  • 0:25
    The difference is that a method lives inside of a class.
  • 0:31
    To create a method, start with public function.
  • 0:35
    After this, it looks like a normal function.