Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Class method as callback in ob_start()

Options
  • 04-09-2002 3: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 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