Error trying to pass regex match to function

后端 未结 5 1627
生来不讨喜
生来不讨喜 2021-01-19 13:03

I\'m getting Syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or \'$\'

This is the code i\'m using

function wpse44503_filter_con         


        
5条回答
  •  面向向阳花
    2021-01-19 13:53

    $2 is not a valid PHP variable. If you meant the second group in the regex then you want to put \2 in a string. However, since you're passing it to a function then you'll need to use preg_replace_callback() instead and substitute appropriately in the callback.

提交回复
热议问题