Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason your code doesn't work is you aren't actually passing a callback. You're just calling that function and passing the return value. A callback in PHP is usually either a string with the function name or an array for object methods.</p> <pre><code>$this-&gt;memcache-&gt;addServer('192.168.1.35', '11211', 0, 50, 10, TRUE, array($this, '_call_memecache_failure'); </code></pre> <p>The parameters should be passed by the function. You can learn more about how callbacks work in PHP <a href="http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback" rel="nofollow noreferrer">in the documentation</a></p> <p>Examples (from the docs):</p> <pre><code>&lt;?php // An example callback function function my_callback_function() { echo 'hello world!'; } // An example callback method class MyClass { static function myCallbackMethod() { echo 'Hello World!'; } } // Type 1: Simple callback call_user_func('my_callback_function'); // Type 2: Static class method call call_user_func(array('MyClass', 'myCallbackMethod')); // Type 3: Object method call $obj = new MyClass(); call_user_func(array($obj, 'myCallbackMethod')); // Type 4: Static class method call (As of PHP 5.2.3) call_user_func('MyClass::myCallbackMethod'); // Type 5: Relative static class method call (As of PHP 5.3.0) class A { public static function who() { echo "A\n"; } } class B extends A { public static function who() { echo "B\n"; } } call_user_func(array('B', 'parent::who')); // A ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload