how to get string from inside brackets in php code example Example: add brackets to string php $withbrackets = '[' . $strName . ']';