quick overview of what i learned about PHP.
this past week i received a PHP code challenge. so in addition to the actual code challenge, i had the additional challenge of learning PHP.
i first started off by googling and read as much PHP documentation. for example, what the naming conventions are, what the code structure generally looks like, arithmetic operators, etc. some of the things that i’ve found out about PHP include:
- script must start with ` php`, but best practices exclude the closing tag `?>` – reasons being that excluding the closing tag to avoid unwanted whitespaces at end of file and be able to add headers to response
- variables start with
$. for example, if i wanted to create a new variable called “hello,” it would look like
- new arrays used to be created with
$new_array = array( );, but now can be created with brackets (
$new_array = [ ];)
print_rare used to output to console