Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Class method as callback in ob_start()

  • 04-09-2002 03:50PM
    #1
    Banned (with Prison Access) Posts: 16,659 ✭✭✭✭


    Anyone know if/how you can use a class method as a callback function in ob_start() (from outside the class)? I've tried the obvious, nuthin doin'.

    adam


Comments

  • Registered Users, Registered Users 2 Posts: 654 ✭✭✭DS


    Same way as most callbacks (preg_replace_callback etc.):
    [PHP]
    $obj = new Class;

    ob_start(array($obj, 'methodName'));

    //or, if you want to change class variables in the callback, you must pass a reference
    ob_start(array(&$obj, 'methodName'));
    [/PHP]


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Figured it out in the meantime Discharger Snake, but thanks anyway.

    adam


Advertisement