Skip to content

Instantly share code, notes, and snippets.

@sbreker
Last active August 17, 2017 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbreker/5674d336a84e24635a5540b9e16b8cf0 to your computer and use it in GitHub Desktop.
Save sbreker/5674d336a84e24635a5540b9e16b8cf0 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
interface foo { }
class object { }
class baseUser extends object { }
class myUser extends baseUser implements foo { }
$user = new myUser();
print("class_implements value: " . json_encode(class_implements('myUser')) . "\n");
print("is_instance_of value: " . is_subclass_of($user,'baseUser') . "\n");
print("is_instance_of value: " . is_subclass_of($user,'object') . "\n");
// Output:
// class_implements value: {"foo":"foo"}
// is_instance_of value: 1
// is_instance_of value: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment