@ 2013-10-03T08:01:07Z <?php
$answer_data=["0","1","0"];
$show_data='a:4:{i:0;O:27:"WpProQuiz_Model_AnswerTypes":7:{s:10:"*_answer";s:12:"A . R rahman";s:8:"*_html";b:0;s:10:"*_points";i:1;s:11:"*_correct";b:1;s:14:"*_sortString";s:0:"";s:18:"*_sortStringHtml";b:0;s:10:"*_mapper";N;}i:1;O:27:"WpProQuiz_Model_AnswerTypes":7:{s:10:"*_answer";s:10:"Sonu Nigam";s:8:"*_html";b:0;s:10:"*_points";i:1;s:11:"*_correct";b:0;s:14:"*_sortString";s:0:"";s:18:"*_sortStringHtml";b:0;s:10:"*_mapper";N;}i:2;O:27:"WpProQuiz_Model_AnswerTypes":7:{s:10:"*_answer";s:10:"Lalu Yadav";s:8:"*_html";b:0;s:10:"*_points";i:1;s:11:"*_correct";b:0;s:14:"*_sortString";s:0:"";s:18:"*_sortStringHtml";b:0;s:10:"*_mapper";N;}i:3;O:27:"WpProQuiz_Model_AnswerTypes":7:{s:10:"*_answer";s:14:"Manmohan singh";s:8:"*_html";b:0;s:10:"*_points";i:1;s:11:"*_correct";b:0;s:14:"*_sortString";s:0:"";s:18:"*_sortStringHtml";b:0;s:10:"*_mapper";N;}}';
$user_answer=json_decode($show_data);
$answer_index=array_search(1,$user_answer);
$answers=unserialize($answer_data);
$i=0;
$correct_ans="";
$user_ans="";
foreach($answers as $ans)
{
if($ans->isCorrect())
$correct_ans=$ans->getAnswer();
if($i==$answer_index)
$user_ans=$ans->getAnswer();
$i++;
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught TypeError: array_search(): Argument #2 ($haystack) must be of type array, null given in /in/L1pFA:5
Stack trace:
#0 /in/L1pFA(5): array_search(1, NULL)
#1 {main}
thrown in /in/L1pFA on line 5
Process exited with code 255 . Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.36 , 5.6.0 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Warning: array_search() expects parameter 2 to be array, null given in /in/L1pFA on line 5
Warning: unserialize() expects parameter 1 to be string, array given in /in/L1pFA on line 6
Warning: Invalid argument supplied for foreach() in /in/L1pFA on line 10
Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 Parse error: syntax error, unexpected '[' in /in/L1pFA on line 2
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected '[' in /in/L1pFA on line 2
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/L1pFA on line 2
Process exited with code 255 . preferences:dark mode live preview
302.58 ms | 401 KiB | 392 Q