本文整理汇总了PHP中question_utils::arrays_same_at_key_integer方法的典型用法代码示例。如果您正苦于以下问题:PHP question_utils::arrays_same_at_key_integer方法的具体用法?PHP question_utils::arrays_same_at_key_integer怎么用?PHP question_utils::arrays_same_at_key_integer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_utils
的用法示例。
在下文中一共展示了question_utils::arrays_same_at_key_integer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_arrays_same_at_key_integer
public function test_arrays_same_at_key_integer()
{
$this->assertTrue(question_utils::arrays_same_at_key_integer(array(), array(), 'key'));
$this->assertFalse(question_utils::arrays_same_at_key_integer(array(), array('key' => 1), 'key'));
$this->assertFalse(question_utils::arrays_same_at_key_integer(array('key' => 1), array(), 'key'));
$this->assertTrue(question_utils::arrays_same_at_key_integer(array('key' => 1), array('key' => 1), 'key'));
$this->assertFalse(question_utils::arrays_same_at_key_integer(array('key' => 1), array('key' => 2), 'key'));
$this->assertTrue(question_utils::arrays_same_at_key_integer(array('key' => 1), array('key' => '1'), 'key'));
$this->assertTrue(question_utils::arrays_same_at_key_integer(array('key' => '0'), array('key' => ''), 'key'));
$this->assertTrue(question_utils::arrays_same_at_key_integer(array(), array('key' => 0), 'key'));
}
示例2: is_same_response
public function is_same_response(array $prevresponse, array $newresponse)
{
foreach ($this->places as $place => $notused) {
$fieldname = $this->field($place);
if (!question_utils::arrays_same_at_key_integer($prevresponse, $newresponse, $fieldname)) {
return false;
}
}
return true;
}
示例3: is_same_response
/** This function is used by the question engine to prevent regrading of
* unchanged submissions.
*
* @param array $prevresponse
* @param array $newresponse
* @return boolean
*/
public function is_same_response(array $prevresponse, array $newresponse)
{
if (!question_utils::arrays_same_at_key_missing_is_blank($prevresponse, $newresponse, 'answer') || !question_utils::arrays_same_at_key_integer($prevresponse, $newresponse, 'rating')) {
return false;
}
return true;
}