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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Class method as callback in ob_start()

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