DEV Community

Discussion on: PHP cheat sheet (updated to PHP 8.1)

Collapse
 
bigdan256 profile image
BigDan256

Great cheat sheet.

Try to use <?php in place of <? as the tag isn't enabled in recommended production or development environments:
; short_open_tag
; Default Value: On
; Development Value: Off
; Production Value: Off
When you use it and it's not enabled, either your file will error out, or your source code will leak to your output.

Try var_export, it's similar to var_dump and print_r. It outputs content in php syntax, similar to how json_encode will return content in json syntax.