search

Home  >  Q&A  >  body text

What is the format of the variables in the return value?

I am a new learner of php. I found a piece of code:

if($x < time()){
     return [false,'error'];
}

The logic or variables don't matter, but I don't understand how [false,'error'] works. Is it a boolean, an array, or...?

P粉757556355P粉757556355228 days ago998

reply all(1)I'll reply

  • P粉649990273

    P粉6499902732024-04-07 19:24:20

    This is an array. It has two elements of two different types. The first element type is Boolean. The second element is a string.

    Arrays in PHP can contain elements of different types.

    reply
    0
  • Cancelreply