From a6f5c9f908a2780df9853cc6bf3f47187487b965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Thu, 23 Apr 2020 21:44:53 +0200 Subject: [PATCH] Use sprintf() instead of long concatenation --- .../test.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php b/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php index 68548f89..f9175ff5 100644 --- a/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php +++ b/samples/tutorials/php/2.0 PHP Server programming - Stored procedures, Transactions, and UDFs/test.php @@ -145,10 +145,14 @@ while ($row = sqlsrv_fetch_array($getProducts, SQLSRV_FETCH_ASSOC)) { break; } $ctr++; - echo $row['SalesOrderID'] . str_repeat(' ', 13) . $row['CustomerID'] . str_repeat( - ' ', - 11 - ) . $row['TotalItems']; + echo sprintf( + '%s%s%s%s%s', + $row['SalesOrderID'], + str_repeat(' ', 13), + $row['CustomerID'], + str_repeat(' ', 11), + $row['TotalItems'] + ); echo('
'); $productCount++; }