is there an alternative for mysql_insert_id() php function for PostgreSQL? Most of the frameworks are solving the problem partially by finding the current value
Check out the RETURNING optional clause for an INSERT statement. (Link to official PostgreSQL documentation)
But basically, you do:
INSERT INTO table (col1, col2) VALUES (1, 2) RETURNING pkey_col
and the INSERT statement itself returns the id (or whatever expression you specify) of the affected row.