I'm following an online PHP tutorial which uses <
and >
instead of <
and >
in the PHP code. For example:
<?php
class User {
function __construct($data) {
$this->id = (isset($data['id'])) ? $data['id'] : "";
$this->username = (isset($data['username'])) ? $data['username'] : "";
$this->hashedPassword = (isset($data['password'])) ? $data['password'] : "";
$this->email = (isset($data['email'])) ? $data['email'] : "";
$this->joinDate = (isset($data['join_date'])) ? $data['join_date'] : "";
}
Is there a reason this is being done or is the formatting on the tutorial website causing it to display like that?
i.e. should I actually be using <
and >
in my .php files?
The tutorial you are following is broken. They are using something to format code in the tutorial, and it is double-escaping the code. You don't need to worry about that.
<
and >
are entities that are used in HTML and XML documents. They are not needed in your PHP code. If you output HTML with your PHP code, then the HTML part you output should contain them if you wish your document to contain a <
or >
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With