php - How can I update this statement to be preg_replace -


as title states can indicate how can correctly update line of code is:

$payment_number = ereg_replace(" |-", "", @$_session['ccdata']['order_payment_number']); 

to preg_replace correctly.

there no need regular expressions! can solve using simple str_replace:

$payment_number = str_replace(array(" ", "-"), "", @$_session['ccdata']['order_payment_number']); 

in case want use regular expressions anyway, have add delimiters make preg compatible:

$payment_number = preg_replace("/ |-/", "", @$_session['ccdata']['order_payment_number']); 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -