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.

3
  • 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. Commented Oct 21, 2015 at 8:58
  • What do you mean by "completely case-insensitive"? Are you talking about all php code or only reserved words? Commented Oct 21, 2015 at 9:02
  • 2
    I'm talking about quite a big part of PHP, as said in this comment in this SA question: 'Are PHP functions case sensitive?'. This blogpost has done some research on this matter. Commented Oct 21, 2015 at 9:10

3 Answers 3

6

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

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

1 Comment

Yes, even you can declare your array like this: $arr = aRrAy(1, 2, 3);
0

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

2 Comments

Functions yes, variable names not: $aaa = 'a'; echo $AAA; -> undefixed $AAA
Thanks @Martijn for pointing that out, I've corrected.
-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.

1 Comment

Javascript is an unrelated context.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.