Heredoc string

You can use the <<< sequence like this (this is called a Heredoc string): The terminating marker must be at the start of a line and the only thing on the line (no comment or even whitespace after it!!!) The advantage of this is that there is no need for line breaks, escape characters (\’ […]

Read More

Using Strings-Values

Formatting Numeric Values Leading Zeros Decimal Places Displaying Date And Time Current Date and Time Values you use: click here Get hours now From A String Variable (e.g. a MySQL result) Display as UTC Values you use: click here Display Value As Hex Or the simpler dechex() method but without forcing the number of characters:

Read More

Using Strings-Extracting

Substring Get String Before & After Character/String If Present Remove First Word In A String Remove Last Word In A String Get String Before First Occurrence Of A String Get String After First Occurrence Of A String Neat way of getting just the string after the search string: Getting String Between Strings

Read More

Special Characters In Strings

Convert backslashed strings $MyString = "a\"b"; echo $MyString; //Will output: a\"b echo stripcslashes($MyString); //Will output: a"b If stripcslashes() doesn't work try using it at the point of outputting the string to the browser, at the echo call.  Using it to convert a string and store in a string won't necessarily work!  

Read More