replace value in array if a field is empty

I am new with php so this might be a silly question. I have this code..

$message = str_replace( array( '%TITLE%', '%VOUCHER%', '%BUYERUSER%', '%DEALPRICE%', '%DIFFERENCE%', '%DATEOFPURCH%' ), array( $offer->post_title, $voucher_code, $user->user_nicename, $offer->deal_owner_price, $offer->deal_sale_price - $offer->deal_owner_price, date("d/m/y") ), $message );

now I would like to set the value of '%DIFFERENCE%' to a string saying not available or something, if $offer->deal_sale_price...

replace value in array if a field is empty

from PHP http://ift.tt/295fkod
via IFTTT
Previous
Next Post »
Thanks for your comment