note 118663 added to mysqli.quickstart.dual-interface
| From: | Anonymous | Date: | Fri, 15 Jan 2016 22:58:10 +0000 |
| Subject: | note 118663 added to mysqli.quickstart.dual-interface | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204695@lists.php.net to get a copy of this message | ||
I don't know whether I can put my opinion here, but yetâ¦
I don't think that mixing styles is so bad idea. Yes, maybe it isn't good when working in
a team, but if you work on a code on your own and it's convenient for you - why not?
For example, I prefer the OO style generally. But when it comes to setting connection, the
procedural style provides opportunity to use easy 'or' syntax:
<?php
$connection = @mysqli_connect('localhost', 'root', '1234',
'db') or die('Connect Error (' . mysqli_connect_errno() . ') ' .
mysqli_connect_error());
?>
which is more convenient for me than:
<?php
$connection = @new mysqli('localhost', 'root', '1234',
'db');
if ($conn->connect_errno) {
die('Connect Error (' . $connection->connect_errno() . ') ' .
$connection->connect_error());
}
?>
So why shouldn't I use the procedural style when setting connection?
----
Server IP: 72.52.91.14
Probable Submitter: 78.56.235.128
----
Manual Page -- http://php.net/manual/en/mysqli.quickstart.dual-interface.php
Edit -- https://master.php.net/note/edit/118663
Del: integrated -- https://master.php.net/note/delete/118663/integrated
Del: useless -- https://master.php.net/note/delete/118663/useless
Del: bad code -- https://master.php.net/note/delete/118663/bad+code
Del: spam -- https://master.php.net/note/delete/118663/spam
Del: non-english -- https://master.php.net/note/delete/118663/non-english
Del: in docs -- https://master.php.net/note/delete/118663/in+docs
Del: other reasons-- https://master.php.net/note/delete/118663
Reject -- https://master.php.net/note/reject/118663
Search -- https://master.php.net/manage/user-notes.php