Use var_dump() to echo a variable: https://www.php.net/manual/en/function.var-dump.php
The version of PHP available from the command line has nothing to do with the version of PHP loaded as a module. These are completely separate things. The version you see in browser when you run phpinfo()
is the version Apache is using and the version you see when you run which php
in cli is the version command line is using. If after upgrading to a new version of php typing php --version
in terminal still shows old version of php you need to update the php path of your $PATH variable which we do using .bash_profile. This is a hidden file in your Mac’s user directory which is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface. Take note that Bash shell uses colon (:) as the path separator; while windows use semicolon (;).
- Find the php folder where new version of php i