We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
That's weird, this works for me (have to remove the random backticks, not sure where they are coming from!):
$fh = fopen("php://stdin", "r");
//What to search for
fscanf(`$fh, '%d', $`v);
//Length of array
fscanf(`$fh, '%d', $`n);
//Get the values to search through
`$arrayValues = explode(' ', fgets($`fh));
//Find the key
echo array_search(`$v, $`arrayValues);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Intro to Tutorial Challenges
You are viewing a single comment's thread. Return to all comments →
That's weird, this works for me (have to remove the random backticks, not sure where they are coming from!):