Get all method names starting with a substring from a PHP object

class, object, oop, php

Solution

You can use `preg_grep()` to filter them:

$method_names = preg_grep('/^bla_/', get_class_methods($object));

Problem

I have an object and want a method that returns how much method this Object have that start with `bla_`. I found `get_class_methods()` which returns all method names, but I only want names which starts with `bla_`

Original source