Note that due to your locale's number formatting settings, you may not be able to pass a numeric value in as a parameter and have it arrive in PostgreSQL still a number.
If your system locale uses "," as a decimal separator, the following will result in a database error:
pg_query_params($conn, 'SELECT $1::numeric', array(3.5));
For this to work, it's necessary to manually convert 3.5 to a string using e.g. number_format.
(I filed this as bug #46408, but apparently it's expected behavior.)