0

I am PHP developer and I am trying to use following code but I don't know I am getting wrong error in PHP 7 but it's working fine at PHP 5:

$output = 5;
echo gettype($output);

The output is:

integerarray

3
  • 1
    Your code outputs integer. Your array output seems to come from another code. Commented Jan 20, 2018 at 10:49
  • working fine. No any issue. Just tested Commented Jan 20, 2018 at 10:51
  • working file in php7 just tested eval.in/938784 Commented Jan 20, 2018 at 10:53

1 Answer 1

1

Your code returns:

integer

for every version of PHP from 5.0.4 to 7.1.0.

You can test it online with this PHP Sandbox.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, But I don't know I am getting integerarray. Actually I am giving an test on app.codility.com/demo/take-sample-test I write following code but its giving me output as array which should not be . function solution($n,$A) { // write your code in PHP7.0 if($n<0){ $output = 1; }else{ $output = $n; } if($output==in_array($output,$A)){ $output++; solution($output,$A); }else{ echo $output; } } $A = array(1,3,6,4,1,2); solution(min($A),$A);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.