Web Programming π/Back-End π₯·π»
PHP Basics
KB0129
2023. 4. 25. 04:25
- PHP code can be embeded directly within an HTML file.
- A PHP file will usually have the extension .php.
- Comment:
- Multi-line block comments /* */
- Single-line comments // or #
PHP Tag Example
Include PHP files
PHP $Variables and Data Types
- Variables in PHP are dynamically typed.
- The PHP engine makes a best guess as to the intended type based on what it is being assigned.
- A variable can be assigned different data types over time.
- Variable names are case sensitive.
- Boolean: A logical true or false value
- Integer: whole numbers
- Float: Decimal numbers
- String: Letters
- Array: A collection of data of any type
- Object: Instance of classes
Writing to Output: echo
We can use echo() to output something.