PDO statements with named parameters VS question mark parameters

后端 未结 3 1150
闹比i
闹比i 2021-01-23 16:43

I have a class for database management, and one of my sub-classes (the one that defines a query) is defined like this (just a sample, many other functions are actually stripped

3条回答
  •  礼貌的吻别
    2021-01-23 17:05

    The difference between named an unamed parameters is that with unnamed parameters you'll have to take care about the order in which they will be bound to the query.

    Especially in your example unnamed params will fit very good as it eases the function call.


    Further note that you won't need to call return $this; in a constructor method.

提交回复
热议问题