Skip to main content
added 12 characters in body
Source Link
z-boss
  • 17.7k
  • 13
  • 55
  • 82

Probably not many know that it is possible to specify constant "variables" as default values for function parameters:

function myFunc($param1, $param2 = MY_CONST) { //code... } 

StringsStrings can be used asas if they were arraysarrays:

$str = 'hell o World'; echo $str; //outputs: "hell o World" $str[0] = 'H'; echo $str; //outputs: "Hell o World" $str[4] = null; echo $str; //outputs: "Hello World" 

Probably not many know that it is possible to specify constant "variables" as default values for function parameters:

function myFunc($param1, $param2 = MY_CONST) { //code... } 

Strings can be used as if they were arrays:

$str = 'hell o World'; echo $str; //outputs: "hell o World" $str[0] = 'H'; echo $str; //outputs: "Hell o World" $str[4] = null; echo $str; //outputs: "Hello World" 

Probably not many know that it is possible to specify constant "variables" as default values for function parameters:

function myFunc($param1, $param2 = MY_CONST) { //code... } 

Strings can be used as if they were arrays:

$str = 'hell o World'; echo $str; //outputs: "hell o World" $str[0] = 'H'; echo $str; //outputs: "Hell o World" $str[4] = null; echo $str; //outputs: "Hello World" 
Post Made Community Wiki
Source Link
Jamol
  • 2.3k
  • 2
  • 28
  • 28

Probably not many know that it is possible to specify constant "variables" as default values for function parameters:

function myFunc($param1, $param2 = MY_CONST) { //code... } 

Strings can be used as if they were arrays:

$str = 'hell o World'; echo $str; //outputs: "hell o World" $str[0] = 'H'; echo $str; //outputs: "Hell o World" $str[4] = null; echo $str; //outputs: "Hello World"