So, I was able to track the actual issue, code was not the real issue, main was environment variable were not set, after setting these things starting running smoothly,
you can set the environment variable in Window 10 as following,
;C:\Program Files\PostgreSQL\10\bin ;C:\Program Files\PostgreSQL\10\lib
Please note: On windows 10, if you follow this: computer => properties => advanced system settings=> Environment Variables => System Variables> select PATH, you actually get the option to add new row. Click Edit, add the /bin and /lib folder locations and save changes.
After that you will face the issue of "invalid password" "password prompt", to avoid this just use SET PGPASSWORD=P0stgres& like below,
<?php print_r(exec('SET PGPASSWORD=yourpassword pg_dump -U postgres -h localhost -d mydb -f "C:\\backup\\backUp.sql" 2>&1'));?>
if above didn't work than put & after yourpassword.
<?php print_r(exec('SET PGPASSWORD=yourpassword& pg_dump -U postgres -h localhost -d mydb -f "C:\\backup\\backUp.sql" 2>&1'));?>
Many thanks to below questions to over come the issue finally :)
Postgres "psql not recognized as an internal or external command"
Setting PGPASSWORD environment variable for Postgres (psql) process executed by Inno Setup