Update index.php
- Made compatible for PHP 8.2 and above.
- It has been rewritten with a more modern and understandable definition.
Update functions.php
- Type Determination: PHP 8.2's type determination features (int, string, void) were used. This makes the code more reliable.
- Abbreviated Logical Expressions: ?? With the operator, if a valid status code is not found for $code, a 500 error code is returned.
- Cleaner and Comprehensive Functions: Function names and logic are the same, but written in a more concise and effective way.
- Minify: The code was cleared of unnecessary spaces and lines, thus gaining a more compact structure.
Update connect.php
- PDO Settings via Array: PDO settings are passed as an array directly in the PDO constructor instead of setAttribute. This makes for shorter, cleaner writing.
- Exit Function Usage: exit is used instead of die, reflecting a more modern PHP usage.
- Default Retrieval Mode: PDO::FETCH_OBJ is set as the default retrieval mode so data will be returned as object. This makes your code a little - cleaner and makes data manipulation easier (optional).