PHP Type Declarations: make your PHP code easier to read, and simpler to use

preview_player
Показать описание

PHP is a dynamically-typed language. This means that variables don't have a fixed type. However, PHP does have an optional strong type system: type declarations (previously known as type hints). In this video we'll see how using this will make your code simpler, easier to read, and easier to maintain.

Resources:

Code shown in the video:

00:00 Intro
00:30 Types in PHP
00:49 Type juggling
02:00 Function arguments
04:40 Type declarations
07:05 Strict type mode
08:15 Available types
08:46 Return values
09:00 Class properties
09:20 Union types
09:30 Nullable
10:02 Summary

#PHP #PHP8
Рекомендации по теме
Комментарии
Автор

The way you explain is amazing and easy to understand.. thanks

emperoroftheearth
Автор

I actually love dynamic typing. It's great.

surfer_silver
Автор

the was the third video to me about this to watch, and the first video make me understand :)

moraaoo
Автор

The simplicity of explanation speaks of high professionalism. Good job! Thanks.

karenmelikyan
Автор

Thanks for the helpful video! I'll probably be taking your courses and wonder if you have any suggestions for learning Apache? It keeps coming up, and I think it'd make my life a lot easier if I understood it instead of just guessing and copying code.

andrew.schaeffer
Автор

What php editor do you use and how do you run this code in command line?

_Mikekkk
Автор

Hello, I want to know, is it possible to give type hinting to roles and permissions separately?

public function getRoles(): array
{
if (Gate::allows('role_access')) {
$roles = Role::with('permissions')->orderBy('id', 'DESC')->get();
$permissions = Permission::all();

return [
'roles' => $roles,
'permissions' => $permissions
];
}
}

sergey_gabrielyan
Автор

Please, will the ?string $username apply to the parameter passed to a Constructor for initialization?

NedumEze
Автор

why did you write "Course" near $course. What is it called and what is its purpose.

johnydevlin
Автор

So... I'm a WordPress theme developer so I'm not really a PHP developer. Can you do a video on the PHP interactive mode? I didn't know this existed until now lol.

MobiusCoin
Автор

Error Number: 1054

Unknown column 'category_table.*' in 'field list'

SELECT `id`, `autor_name`, `title`, SUBSTRING(`content`, 1, 300) AS content, `image_url`, `show_first`, `date_creation`, `views`, `featured_for_menu`, `category_table`.`*` FROM `aricle_table`, `category_table` WHERE `aricle_table`. `id_category`= ORDER BY `date_creation` DESC LIMIT 7 OFFSET 0

Filename:

Line Number: 691

mohamedab
join shbcf.ru