-
What will be the output of the following PHP code?
<?php
function convertSpace($str)
{
return str_replace("_", " ", $str);
}
$str = "Interview_Mania_is_good_for_interview_preparation!";
echo filter_var($str, FILTER_CALLBACK, array("options"=>"convertSpace"));
?>
-
- Error
- Interview_Mania_is_good_for_interview_preparation!
- Nothing
- InterviewManiaisgoodforinterviewpreparation!
- Interview Mania is good for interview preparation!
Correct Option: D
The code above converts all “_” to white spaces. Call the filter_var() function with the FILTER_CALLBACK filter and an array containing our function.