Ehhhh sorta. I would agree with the breaking of variables out, mainly because I don't agree with PHP's handling of parsable strings. For that reason, I tend to stay with single quotations and use escaping.
I'm a print formatter though, so more often you would see me using something more along this lines:
PHP Code:
$sQry = sprintf('SELECT * FROM %s WHERE %s = \'%s\'', 'myTable', 'myField', $myField);
Which actuallly worked out pretty good with the new mysqli extension replacement for the binding.
The problem with the one that you have is that there is no optimization gain at this point. The original use of double quotations will slow down the processing (since it assumes there may be variables that need expansion), so breaking out I would suspect would slow it down even more; however, at the same time with a colour mark-up it is very readable since I can identify every variable in use.
This would probably be the fastest next to the sprintf:
PHP Code:
$strQuery = 'insert into paypal_payment_info(paymentstatus,buyer_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,itemnumber,itemname,os0,on0,os1,on1,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values (\''.$payment_status.'\',\''.$payer_email.'\',\''.$first_name.'\',\''.$last_name.'\',\''.$address_street.'\',\''.$address_city.'\',\''.$address_state.'\',\''.$address_zip.'\',\''.$address_country.'\',\''.$mc_gross.'\',\''.$mc_fee.'\',\''.$item_number.'\',\''.$item_name.'\',\''.$option_name1.'\',\''.$option_selection1.'\',\''.$option_name2.'\',\''.$option_selection2.'\',\''.$quantity.'\',\''.$memo.'\',\''.$payment_type.'\',\''.$payment_date.'\',\''.$txn_id.'\',\''.$pending_reason.'\',\''.$reason_code.'\',\''.$tax.'\',\''.$fecha.'\')';
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
No, not enough to substantiate a change in you're programming practice.
I've always written my code like this so its not a problem for me. The double quotation variable expansion is a feature of PHP, and is optimized fairly well considering what it does. It is slower yes, but this is coming into the nitpick details like comparing the speed of using:
PHP Code:
for ($i = 0; $i < $count; $i++)
versus
PHP Code:
for ($i = 0; $i < $count; ++$i)
where the latter is faster and better on memory since preincrements don't require temporary variables. They will both complete in a reasonable time (assuming the loops are well controlled), but the pre-increment will complete in a more reasonable amount of time.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php