$i++; if ($i <= 5) { //test4($i); $func = __FUNCTION__; //系统函数得到当前函数名称 $func($i); } } test4(3); echo '<hr />'; function testName() { echo __FUNCTION__; //得到当前函数的名称 } testName(); //testName; echo '<hr />'; /* func_num_args():得到传入函数参数的个数 func_get_arg($index):根据下标得到指定参数 func_get_args():得到所有传入进来的参数,得到是一个数组 */ function test2() { echo func_num_args(); echo '<br/><br/>'; echo func_get_arg(0), '<br/>'; echo func_get_arg(1), '<br/>'; echo func_get_arg(2), '<br/>'; echo func_get_arg(3), '<br/>';
} } else { if ($table == 'AddToMovie') { //$_POST['aod'] returns 'Actor' OR 'Director //$_POST['a_first'] returns first name raw input //$_POST['a_last'] returns last name raw input //$_POST['a_title'] returns title name raw input //TODO: Verify input is correct. Then check first name and last name against database to make sure //actor or director exists. If doesn't exist, display a message "Actor doesn't match our records.", "Director doesn't match our records.", //and/or "Movie doesn't match our records." If actor, director, and movie exist, grab their IDs and insert //tuple into MovieActor and MovieDirector tables respectively. $first = test_input($_POST['a_first']); $first_err = testName($first); $title_err = $role_err = 0; $last = test_input($_POST['a_last']); $last_err = testName($last); $title = $_POST['a_title']; if (empty($title)) { $title_err = 1; } $role = test_input($_POST['a_role']); if (empty($role)) { $role_err = 1; } $success_msg2 = ""; $error_msg2 = ""; $post2 = 1; $id_actor_director = $id_movie; $check_movie = $check_actor_director = 0; if (!$first_err && !$last_err && !$title_err && !$role_err) { //person exist