note 119539 added to function.call-user-func-array
| From: | wriver4 at gmail dot com | Date: | Sat, 02 Jul 2016 03:05:14 +0000 |
| Subject: | note 119539 added to function.call-user-func-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205864@lists.php.net to get a copy of this message | ||
Kris dot Craig at gmail dot com dispatch table does not work currently, but this does.
<?php
define("YOUR_MOTHER", 1);
define("YOUR_FATHER", 2);
define("YOUR_BROTHER", 3);
define("YOUR_SISTER", 4);
class MyFamily
{
static $dispatch = array(
YOUR_MOTHER => "mom",
YOUR_FATHER => "getPrisonInmate",
YOUR_BROTHER => "replaceName",
YOUR_SISTER => "lazyGirl");
static $args = array(
YOUR_MOTHER => array(),
YOUR_FATHER => array(
"55170-054",
TRUE,
3),
YOUR_BROTHER => array(),
YOUR_SISTER => array());
function getDispatch($fromwhere)
{
return call_user_func_array(array(
get_class(),
self::$dispatch[$fromwhere]), self::$args[$fromwhere]);
}
function mom()
{
return "Mommy loves you!";
}
function getPrisonInmate($PrisonerID, $GoodBehavior, $remaining,
$notes = null)
{
//Check prison records for his ID, then....
if ($GoodBehavior)
{
$parole = "APPROVED";
}
else
{
$parole = "DENIED";
}
return "Your father (#$PrisonerID) has $remaining years left in his sentence. His most
recent parole application has been: $parole";
}
function replaceName()
{
return "Her name is Sally now.";
}
function lazyGirl()
{
print "Your sister needs to get out more....";
//sleep(pow(60, 2) * 18); //You can sleep later!
die("Nah, I'm too tired.");
}
}
print "Status on family member:
".MyFamily::GetDispatch(YOUR_FATHER).'<br><br>';
----
Server IP: 72.52.91.14
Probable Submitter: 68.13.223.70
----
Manual Page -- http://php.net/manual/en/function.call-user-func-array.php
Edit -- https://master.php.net/note/edit/119539
Del: integrated -- https://master.php.net/note/delete/119539/integrated
Del: useless -- https://master.php.net/note/delete/119539/useless
Del: bad code -- https://master.php.net/note/delete/119539/bad+code
Del: spam -- https://master.php.net/note/delete/119539/spam
Del: non-english -- https://master.php.net/note/delete/119539/non-english
Del: in docs -- https://master.php.net/note/delete/119539/in+docs
Del: other reasons-- https://master.php.net/note/delete/119539
Reject -- https://master.php.net/note/reject/119539
Search -- https://master.php.net/manage/user-notes.php