function testStrictTypedArgument()
{
    doEverything(123);
    // ok
    doEverything(123.4);
    // ok
    doEverything("123");
    // ok
    doEverything("123.4");
    // ok
    doEverything("abc");
    // ok
    doSomething(123);
    // ok
    //doSomething(123.4);  // Type error: ...must be of the type integer, float given
    //doSomething("123");  // Type error: ...must be of the type integer, string given
    //doSomething("123.4");  // Type error: ...must be of the type integer, string given
    //doSomething("abc");  // Type error: ...must be of the type integer, string given
    doEveryLittleThing(123);
    // ok
    doEveryLittleThing(123.4);
    // ok
    //doEveryLittleThing("123");  // Type error: ...must be of the type float, string given
    //doEveryLittleThing("123.4");  // Type error: ...must be of the type float, string given
    //doEveryLittleThing("abc");  // Type error: ...must be of the type float, string given
    //doAnything(123);  // Type error: ...must be of the type string, integer given
    //doAnything(123.4);  // Type error: ...must be of the type string, float given
    doAnything("123");
    // ok
    doAnything("123.4");
    // ok
    doAnything("abc");
    // ok
}
예제 #2
0
// Enable debugging. Errors are reported to Web server's error log.
//  YahooLogger::setDebug(true);
// Initializes session and redirects user to Yahoo! to sign in and
// then authorize app
$yahoo_session = YahooSession::requireSession(CONSUMER_KEY, CONSUMER_SECRET, APP_ID);
if ($yahoo_session == NULL) {
    fatal_error("yahoo_session");
}
$fren_updates_key = "fren:v1:updates";
$fren_updates = mem_get($fren_updates_key);
if (!$fren_updates) {
    $data_orig = $yahoo_session->query('select * from social.updates.search where source="APP.7BNRkt42" limit 10');
    $fren_updates = $data_orig->query->results->update;
    mem_set($fren_updates_key, $fren_updates, 3600);
}
$leaders = doEverything($yahoo_session);
foreach ($leaders as $leader) {
    $me = $leader;
    break;
}
$badge_names = array("agg.twitter" => "Tweetoo", "avatars" => "Beharupia", "buzz" => "Buzzooka", "y.mybloglog" => "BloggY!", "socialite" => "Socialite", "newbie1" => "Newbie");
$badge_desc = array("agg.twitter" => "You've shared 5 twitter updates!", "avatars" => "You've creating a Yahoo! avatar", "buzz" => "You've buzed up 3 times", "y.mybloglog" => "You've sharing 10 blog updates", "socialite" => "You've updates from 8 different sources", "newbie1" => "Congrats! On sharing your updates");
krsort($leaders);
track($me["nickname"], $me["guid"], $me["count"]);
// $me=array("count"=>20);
?>
<style>
h1 {
color:#E57F3E;
font-size:18px;
font-weight:bold;