Menu
H
HomeA
AptitudeE
EnglishR
ReasoningD
DIG
GKC
Current AffairsI
Interview- Computer
C
Computer FundamentalsN
NetworkingS
SQLD
Database
- Programming
C
C ProgramJ
Java ProgramH
HTMLC
CSSJ
P
PHP Program
- Engineering
C
Computer ScienceE
Electrical EngineeringM
Mechanical EngineeringC
Civil EngineeringC
Chemical Engineering
- More
B
Banking AwarenessC
CommerceM
Management
A
Ask Question
- Home
- Aptitude
- English
- Reasoning
- DI
- GK
- Current Affairs
- Interview
- Computer
- Computer Fundamentals
- Networking
- SQL
- Database
- Programming
- C Program
- Java Program
- HTML
- CSS
- Javascript
- PHP Program
- Engineering
- Computer Science
- Electrical Engineering
- Mechanical Engineering
- Civil Engineering
- Chemical Engineering
- More
- Banking Awareness
- Commerce
- Management
- Ask Question
Which of the following are valid function names? 1. function[] 2. €[] 3. .function[] 4. $function[]
A. Only 2
B. None of the mentioned
C. All of the mentioned
D. 3 and 4
Answer: Option A
Solution[By Examveda Team]
Except a] others are invalid names. According to the specified regular expression [[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*], a function name like this one is valid.
Click here to read 1000+ Related Questions on Functions[PHP]
Join The Discussion
Related Questions on Functions
A function may be defined using syntax such as the following:
Example #1 Pseudo code to demonstrate function uses
Any valid PHP code may appear inside a function, even other functions and class definitions.
Function names follow the same rules as other labels
in PHP. A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$
.
Functions need not be defined before they are referenced, except when a function is conditionally defined as shown in the two examples below.
When a function is defined in a conditional manner such as the two examples shown. Its definition must be processed prior to being called.
Example #2 Conditional functions