PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, December 18, 2022

[FIXED] What is the variable's format in the return value?

 December 18, 2022     php, return, syntax     No comments   

Issue

I am a new learner in php. I found that there is a code:

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

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


Solution

It's an array. It has two elements of different two types. The first element type is boolean. The second element is a string.

Arrays can have elements of different types in PHP.



Answered By - Martín Lehoczky
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing