PHP: How to use password_hash and password_verify

In this article I will describe how to use two PHP functions, password_hash and password_verify, that are important for website login pages that use a user name and password. 1. password_hash() Here is what the PHP documentation says about password_hash: password_hash() creates a new password hash using a strong one-way hashing algorithm. password_hash() is compatible … Continue reading PHP: How to use password_hash and password_verify

How to install PHP/MySQL and confirm the installation

The quickest way I found to install PHP and MySQL was to download the Bitnami WAMP stack module, which also installs a fresh Apache 2 server. See: https://bitnami.com/stack/wamp The installer I found for Windows 10 was called “bitnami-wampstack-7.1.14-0-windows-x64-installer.exe”. In running the installation, Bitnami creates a folder for apache2, php, and mysql here: C:\Bitnami\wampstack-7.1.14-0 Bitnami also … Continue reading How to install PHP/MySQL and confirm the installation

PHP: How to print information about variables, arrays, and objects

To print information about variables, arrays or objects in PHP, we can use the following functions: print_r() var_dump() var_export() print_r( ) According to this explanation on stackoverflow.com, print_r(): Outputs a human-readable representation of any one value Accepts not just strings but other types including arrays and objects, formatting them to be readable Useful when debugging … Continue reading PHP: How to print information about variables, arrays, and objects

PHP: How to output text, variables, and HTML markup using print and echo

In PHP there are two ways to “print” HTML markup, text, and variables, using print and echo. These are essentially interchangeable, though print is slower, so best practice is to use echo. “print” has a return value of 1 (so it can be used in expressions), while “echo” does not.  print can take one argument, … Continue reading PHP: How to output text, variables, and HTML markup using print and echo

Python and PHP: A comparison of the language basics

In this table I will compare some basic programming syntax and conventions between the Python and PHP programming languages. Programming element Python PHP Code commenting PHP supports Python and JavaScript conventions # Single line comment “””This is a multi-line comment block. This is a multi-line comment block.””” # Single line comment // Single line comment/*This … Continue reading Python and PHP: A comparison of the language basics