

bindParam ( ':nome', $nome, PDO :: PARAM_STR ) $sth -> bindParam ( ':email', $email, PDO :: PARAM_STR ) $sth -> bindParam ( ':fone1', $fone1, PDO :: PARAM_STR ) $sth -> bindParam ( ':fone2', $fone2, PDO :: PARAM_STR ) $sth -> bindParam ( ':nome_fantasia', $nome_fantasia, PDO :: PARAM_STR ) $sth -> bindParam ( ':razao_social', $razao_social, PDO :: PARAM_STR ) $sth -> bindParam ( ':cpf', $cpf, PDO :: PARAM_STR ) $sth -> bindParam ( ':cnpj', $cnpj, PDO :: PARAM_STR ) $sth -> bindParam ( ':rg', $rg, PDO :: PARAM_STR ) $sth -> bindParam ( ':ie', $ie, PDO :: PARAM_STR ) $sth -> bindParam ( ':cidade', $cidade, PDO :: PARAM_STR ) $sth -> bindParam ( ':estado', $estado, PDO :: PARAM_STR ) $sth -> bindParam ( ':rua', $rua, PDO :: PARAM_STR ) $sth -> bindParam ( ':cep', $cep, PDO :: PARAM_STR ) $sth -> bindParam ( ':numero', $numero, PDO :: PARAM_STR ) Here is the raw input lines I had, copied from an SQL statement somewhere else. This one is very similar, actually, but I do think it is worth to take a look at it nonetheless. Example #2 - db columns to PHP/PDO bindParam It is important to note the use of the ! character so that the text in the selected lines is sent to the external program, operated on and then placed back (after modification), effectively replacing the old, unaligned columns with the new, aligned ones. Visually select the lines again (you may use gv) and then run:
#Asciinema vim code#
If the code style of your code base uses assignments in aligned columns, it is possible to use the column command line (available on *nix systems) to nicely align the columns. Then it just adds the $ followed by the previous matched text in the capturing group \1 followed by = param('\1'), which results in every line with the single variable being turned into $varname = param('varname') statements.

That command did a lot, didn’t it‽ Basically, it matches the “word characters” after the $ and saves it in a capturing group: \(\w+\).
