PHP: Difference between revisions

From miki
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:
$attr = array("border"=>"myborder", "mode"=>"mymode"); // associative array
$attr = array("border"=>"myborder", "mode"=>"mymode"); // associative array


/* strings */
'abc' . 'def' // concatenation
"abc $var def" // variable reference in strings
$s=str_replace("\n","",$s); // Replace a substring in a string
$s=str_replace(array("\r","\n","\t"," "),"",$s; // ... idem, with several substrings (also support several "replace" strings)


/* constant */
/* constant */

Revision as of 04:20, 2 January 2016

References

TBC

Syntax

/* arrays */
$attr = array();          // an empty array
$attr = array("border"=>"myborder", "mode"=>"mymode");   // associative array

/* strings */
'abc' . 'def'                                     // concatenation
"abc $var def"                                    // variable reference in strings
$s=str_replace("\n","",$s);                       // Replace a substring in a string
$s=str_replace(array("\r","\n","\t"," "),"",$s;   // ... idem, with several substrings (also support several "replace" strings)

/* constant */
NULL;              // The null reference