# Can you crack it? - 3 Digit Code Lock

PM your answer to me. I will post who gets it right.

3 Likes

yes, I can crack it.

PM your answers. Dont post it here.

Really?
I did not think that it would pose that much
of a problem for the coders around here.

If you post it here and you are right there is no point in anyone else figuring it out.

I never actually thought about posting a solution,
but just assumed that an answer to the questionâ€¦

â€śCan you crack it?â€ť

â€¦was what you required.

Speaking like a computer, eh?

1 Like

Maybe this will help some folks:

``````<?php declare(strict_types=1);
error_reporting(-1);
ini_set('display_errors', 'true');

function fred(\$val)
{
foreach(\$val as \$num) :
echo ' &nbsp; ' .\$num;;
endforeach;
echo '<br>';
}

\$x1 = [6, 8, 2, ' - one correct and well placed ']; //
\$x2 = [6, 1, 4, ' - one correct and wrong placed'];
\$x3 = [2, 0, 6, ' - two correct and wrongly placed'];
\$x4 = [7, 3, 8, ' - none correct'];
\$x5 = [3, 8, 0, ' - one correct and wrong placed'];

fred(\$x1);
fred(\$x2);
fred(\$x3);
fred(\$x4);
fred(\$x5);
``````

#### Edit:

Spelling not my forty

How is that going to help when you got the numbers wrong?

1 Like

I found it easier to validate my attempts by having the following test at the start:

`\$x0 = [1, 2, 3, ' - attempt 001']; //`

I have no idea what you are doing and there is no 380.

1 Like

I found it easier to find the solution when the hints were nicely line up on the screen.

Whoops - it should have been â€ś7 8 0â€ť.

Congratulations to @m_hutley for being the first one to get it right.

John - This cant be correct if â€ś7 3 8â€ť 's result is â€śNothing is correct.â€ť

He meant the numbers in the last hint box.

1 Like

Ohh. Right. Iâ€™m awake. Itâ€™s not 3 AM. Shhhhhh.

1 Like

Cant be doing too bad, you are the only one to get it right.

Let me know if you â€ścloseâ€ť this at some point, @benanamen, and iâ€™ll come back and give my way of figuring it out (Which is NOT saying that itâ€™s the only way. Just how my mental gymnastics worked). In a spoiler block, of course.

You can tell me in PM if you like. I am interested to know how you did it.

John Betong cheated and used google to find the answer.

1 Like