It looks like you just need to adjust the order of some things. I don't know if I can tell you exactly why it isn't working for you, but I did just test the snippet I gave you and it is working just fine on my site.
As far as I can tell right now, it just seems that another part of your .htaccess file is interfering with the snippet I gave you. I can't really test your specific case, all I can do is take some guesses and let you try them out. This next snippet of code should do 3 things: 1) accept urls missing '.php' as the extension (if the file exists), 2) redirect 'example.com' to 'www.example.com' (matching http and https), 3) remove 'index.php' from any url (as it simply indicates the base/index file for a given directory).
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^index.php$ / [L]