4

In this OOP tutorial, I noticed the following code:

public function validate(Array $data, Array $rules){}

My question is if that is the same as:

public function validate(array $data, array $rules){}

In the PHP.net documentation, I could find a reference only to the second form.

Michael Haddad
  • 4,085
  • 7
  • 42
  • 82
  • It seems that they both mean the same thing. In other news; during a little research for this question I have found out that PHP is in general completely case-insensitive. Ergo: you can use whatever case you'd like. – klaar Oct 21 '15 at 08:58
  • What do you mean by "completely case-insensitive"? Are you talking about all php code or only reserved words? – Michael Haddad Oct 21 '15 at 09:02
  • 2
    I'm talking about quite a big part of PHP, as said in [this comment](http://stackoverflow.com/a/18516698/5147246) in [this SA question: 'Are PHP functions case sensitive?'](http://stackoverflow.com/questions/5643496/are-php-functions-case-sensitive). [This blogpost](http://the-echoplex.net/log/php-case-sensitivity) has done some research on this matter. – klaar Oct 21 '15 at 09:10

3 Answers3

5

They are both the same. Some IDEs only recognize one of the forms, though. (Just like stackoverflow itself, which only stylizes Array

Luis Ávila
  • 689
  • 4
  • 14
0

Short answer: PHP constructs, class names, functions and user-defined functions are case-insensitive.

-5

Javascript can only usw "Array". Using "array" in PHP is no problem, but if you want do use Javascript too, it will cause an error.

HightronicDesign
  • 699
  • 1
  • 9
  • 15