10: Type Declarations In OOP PHP | Type Hinting In PHP | Object Oriented PHP Tutorial | PHP Tutorial

  Рет қаралды 76,835

Dani Krossing

Dani Krossing

Күн бұрын

Пікірлер: 70
@Dani_Krossing
@Dani_Krossing 5 жыл бұрын
Hi everyone! It has been a while since the last upload. I have had my office under maintenance, and I have had technical issues with my PC and the equipment I use to record videos, which is the reason why it took so long. I'm still having technical issues but I'm hoping that I'll manage recording until I get it fixed.
@NikhilPatil4u
@NikhilPatil4u 5 жыл бұрын
bro nice teaching skills you doing great job man.
@coltaarav5416
@coltaarav5416 3 жыл бұрын
i know it's kinda randomly asking but do anyone know of a good place to stream newly released movies online?
@pedrofernandez9707
@pedrofernandez9707 5 жыл бұрын
I have to say it Daniel, it has been few years since the last time I was into progamming, and I just wanted to refresh my knowledge. Your content is so specific and entertaining that I've watched 10 episodes today while practicing. Great work, and thank you for sharing you're knowledge with us.
@YPLabs
@YPLabs 5 жыл бұрын
Thank you so much! I have watched all the OOP PHP tuts of yours, but you never mentioned or promote some of your products (if you have any). If you dont have products, create some udemy courses or something (some way people can support you). Use the platform to your advantage still give free info like this but also promote your business. You are a very nice guy, keep it up!
@suong534
@suong534 5 жыл бұрын
He had mention before that he doesn't want to put his content on Udemy because he wants everyone access his content for free. You can support him by donate on patreon 😉
@OPGAMER.
@OPGAMER. 4 жыл бұрын
Finally Learn Half OOP PHP in Just Few Hours! Thanks Daniel for Such Awesome Tutorials!! Better Than What Teacher Teaches!!
@musmodtos
@musmodtos 3 жыл бұрын
Great course, thank you, I've been programming for years but always worked procedurally (!) which has really held me back in the modern world. As a 'C' programmer though not declaring types has always made me a bit uneasy when working with PHP - at last, the mystery resolved! Thanks mate :)
@edgar-mmxxiii
@edgar-mmxxiii 3 жыл бұрын
Strict typing is always a good thing to do in coding. It helps avoid unpredictable results and debugging headaches.
@othuswill6617
@othuswill6617 4 жыл бұрын
Thank you so much Dani.. I really enjoy your teaching... I was at the verge of giving up on coding when I came across some of your tutorials, and ever since then I have been coding again and now I have fallen in love with it. Thank you so much man.
@tobi_dosumu
@tobi_dosumu 4 жыл бұрын
You're an incredibly awesome tutor! Thank you very much! You just taught me PHP.
@RobinHayer
@RobinHayer 5 жыл бұрын
That's great, php 7 changed the game , this was great lesson and opened my mind for other opportunities for my codes.
@MSKWebServices
@MSKWebServices 6 ай бұрын
Following your tutorial since 2018
@aldrinjohnencina6153
@aldrinjohnencina6153 Жыл бұрын
thank you so much. you explained it clearly.
@ThatoJChere
@ThatoJChere 4 жыл бұрын
This guy is the best i tell you...
@gabrielfono844
@gabrielfono844 3 жыл бұрын
you are incredibly awesome tutor thanks so much I really needed it
@mattbilly4304
@mattbilly4304 5 жыл бұрын
It's great to have you back. Pls, if you won't mind making a video on like and unlike button to an article page also a hit counter which count the number of visits or views to the article page. Thanks so much in advance.
@savilboy7269
@savilboy7269 4 жыл бұрын
The best like always, top man! Thanks
@tanzimibthesam5861
@tanzimibthesam5861 5 жыл бұрын
Want a project with OOP PHP.Keep up the good work
@muhammadtaifkhan4359
@muhammadtaifkhan4359 5 жыл бұрын
your videos are great! please ever make a video on visitors count in website using cookies. Thanks for your awesome videos and for your teaching . keep up the good work.....
@NawabKhan-vq5de
@NawabKhan-vq5de 5 жыл бұрын
amazing sir keep it . We are waiting for your more tut
@yashvardhan8696
@yashvardhan8696 4 жыл бұрын
thank you sir
@rupak_dahal
@rupak_dahal 2 жыл бұрын
Hi Dani, I should really appretiate your effort and Still on 2022 someone is out there learning oop php from your video. Thank you so much for that. however, around time 3:30 yo say by double quote we can assign integer as string which actually happened in my code that i copied yours, where if i pass setname(2) without the double quote there is an error message but when i setName("2") then there is no error, but around 3:40 you said this has to be an error message. but no error was shown even though i have declared the strict type 1 in my index file. Your help and answer would be much appretiated thank you.
@jandefajardo7136
@jandefajardo7136 5 жыл бұрын
Hi, do you have a CRUD tutorial for OOP PHP?
@almojaiderbakal3529
@almojaiderbakal3529 3 жыл бұрын
up
@alisaadati8006
@alisaadati8006 2 жыл бұрын
this part of video was nice
@MathijsGroothuis
@MathijsGroothuis 4 жыл бұрын
Nice video! Maybe you could also say something about defining return types for methods.
@gamnguyen3116
@gamnguyen3116 5 жыл бұрын
Thank you so much!
@alisaadati8006
@alisaadati8006 2 жыл бұрын
thank you
@marcelloperri183
@marcelloperri183 5 жыл бұрын
What PHP version are you using? the type declaration is not allowed anymore in php7, can only be used to force the types of objects and arrays
@Dani_Krossing
@Dani_Krossing 5 жыл бұрын
If you go to the official PHP.net documentation, it doesn’t say type declaration isn’t allowed anymore. Can you provide evidence of this claim?
@marcelloperri183
@marcelloperri183 5 жыл бұрын
@@Dani_Krossing I am very sorry, my bad, it's all the way around. I am running PHP 5.6 and prior to PHP 7 type hinting can only be used to force the types of objects and arrays. In my case the error that I get is "Argument 1 passed to Person::__construct() must be an instance of string, string given, called in". sorry
@Dani_Krossing
@Dani_Krossing 5 жыл бұрын
Just glad it got cleared up :)
@rafaelmartineztomas4911
@rafaelmartineztomas4911 3 жыл бұрын
Hahaha cracking with the patches on the video , so funny
@rimantasdanilevicius6754
@rimantasdanilevicius6754 5 жыл бұрын
Hi, you probably know what is magic method. Do you use it in your projects or you recommend more to you use regular syntax for getters and setter as in you example? P.s just a thought: you can add int, string, array and other Type Declarations into parameters, for example: public int $name ; it would be faster and easier to find. unless you will need every time to call setters to change data type. But I am not sure how often it would be needed.
@abdelrahmanayman5997
@abdelrahmanayman5997 4 жыл бұрын
Thank u very much for this cool course. I have a question, Is enabling restrict mode may cause some security problems?
@christye-x8k
@christye-x8k 5 ай бұрын
You are good sir, upload your tutorials on UDEMY to make more cashflow.
@dondada1507
@dondada1507 5 жыл бұрын
declare(strict_type = 1) must be first line of code, aswell as session_start() What if I have to use both and the same time ? Btw why wouldn't I go for **if(is_string($var)) {//code here}**
@ApplicableProgramming
@ApplicableProgramming 4 жыл бұрын
strict_type can go above the session_start, but they do not interfeer so it doesn't actually matter. you can check on string manually, and probably should. Declaring types helps future developer understanding what type should be passed to the method/function, and a good IDE can warn you even before you run your code that there is some type missmatch
@aleksandarpredojevic6600
@aleksandarpredojevic6600 5 жыл бұрын
That is a great thing, but i think that it doesn't matter what type is user giving because anything that is typed in forms is going to be string, and that is the only way that we let user communicate with our app, but anyway i didn't know about this and it's great that php is going in that direction
@Dani_Krossing
@Dani_Krossing 5 жыл бұрын
Type Declarations isn't as much meant to catch errors the user generates through primitive data types, it is more meant for the developer. In our case here in this course, for when we start working with instances of other classes or the same class. However either way, it is seen as best practice to use Type Declaration whether or not you are working with primitive data types or not.
@nareshramini1796
@nareshramini1796 5 жыл бұрын
But what if you were to pass in the digit "2" as parameter with strict mode set to 1? Wouldn't it take that 2 as string too and spit out 2 on the browser as output too?? When you explained it before altering the code to practicality you mentioned one can't even pass the digit as string if it's wrapped in double quotes with strict mode enabled or strict mode set to 1(true)!
@emanuelegurini
@emanuelegurini 5 жыл бұрын
Hi mm, but this works just if you declare type inside the parentheses?
@augischadiegils.5109
@augischadiegils.5109 3 жыл бұрын
@peterkim9696
@peterkim9696 5 жыл бұрын
Will u do unity tutorials?
@perianka
@perianka 4 жыл бұрын
ty
@iq.scholar
@iq.scholar 5 жыл бұрын
What editor do you use?
@cunjur5802
@cunjur5802 5 жыл бұрын
Looks like Atom (atom.io/)
@Zuldria
@Zuldria 5 жыл бұрын
Kakarott Milan Atom
@nipunsachinda
@nipunsachinda 5 жыл бұрын
I have some problem bro.i have mssql database date .i wrote the program to received the data in to the html table.now i want to get the table data and store in the mysql data table .how do i solved the question??
@TheOlympic1
@TheOlympic1 5 жыл бұрын
Hi Daniel, I have made a registration form using your tutorials and was wondering if there is a way to get and show errors on the form without using the URL and GET method.
@TheOlympic1
@TheOlympic1 5 жыл бұрын
I found a way to do this using $_SESSION
@lars7513
@lars7513 5 жыл бұрын
Hallo, can you make a video about how to scale Ifram to work width the content? I am using that for some of my client`s website for embedding booking website for courses?
@Viralplace
@Viralplace 4 жыл бұрын
I start to use type declarations in my functions but just for int, string and array without strict_type = 1, I use these just to help the future developer to know how type of dato should go there... is a correct way to do that?
@ApplicableProgramming
@ApplicableProgramming 4 жыл бұрын
That is ok, it is also very useful for your IDE, as it will know as well what type is expected, so it can show you error message (type missmatch) even before you run your code.
@jhamaker
@jhamaker 2 жыл бұрын
I like your teaching style. However, one issue I've found is that the course as it's set up now is not using consistent files, which is making this difficult to follow. This particular lesson is throwing an error because too few arguments are being passed. I believe this is because the __construct method was deleted at some point, but this isn't shown. You also didn't include the name space from the previous lesson. Some of this is pretty easy to figure out, but having to figure out errors unrelated to the lessons distracts from learning the concept of the course. Especially when you introduce a concept - such as name space and constructor - and then don't use it in subsequent videos.
@mahirdaiyansafwaan2148
@mahirdaiyansafwaan2148 5 жыл бұрын
Awesome
@sergey_gabrielyan1001
@sergey_gabrielyan1001 3 жыл бұрын
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 ]; } }
@thameshvarenraman7724
@thameshvarenraman7724 5 жыл бұрын
while I trying this tutorial. I get an error message that " Fatal error: Class 'Dbh' not found "
@dondada1507
@dondada1507 5 жыл бұрын
Have you followed previous tutorial ? Make sure you gave the right path of the class.
@RSTao77432
@RSTao77432 5 жыл бұрын
Using Strict Types What Type Would this __Construct Function be: function __construct( $db=NULL, $cookie_prefix = 'usr' . ':' . 'hash-cookie' .bin2hex(16), $table_wildcard = '%t' ) Would it be a String, Has numbers in it aswell...
@princevishwakarmaa
@princevishwakarmaa 5 жыл бұрын
why you have delete rest of the videos???
@Dani_Krossing
@Dani_Krossing 5 жыл бұрын
Hi, I haven't deleted the videos. I just removed them from the playlist since the order of the videos didn't make sense anymore. Newer videos are planned for the future, however if you want to see the old ones I removed, you can find them on my channel.
@SalmanKhan-wt8rx
@SalmanKhan-wt8rx 5 жыл бұрын
I am new to coding. And honestly saying I have watched many videos to understand OOP but couldn't figure it out. I am badly waiting for your videos but it seems like you have a technical issue. I am expecting some practice videos on OOP afterwards.
@anubhaw_bhalotia
@anubhaw_bhalotia 4 жыл бұрын
Great tutorial. However I was not able to get any errors on my browser and I had to use ini_set('display_errors', '1'); error_reporting(E_ALL);
@mhassan2018
@mhassan2018 5 жыл бұрын
Dear Mr denial Hi iam an amateur in web development i have an issue hope that you can help me with --- i cant understand tutorial that about .htaccess the way you redirect all requests to index.php then use $_SERVER['REQUEST_URI'] can you please do that tutorial for us really appreciate your effort and thanks in advance
@joem1668
@joem1668 5 жыл бұрын
another one
@phpcoderforever
@phpcoderforever 3 жыл бұрын
declare("strict_types = 1);
@markusprutsch5651
@markusprutsch5651 2 жыл бұрын
Isn't strict_type = 1 kinda ironic? 😂
@AxxionMarketPlace-iu6ri
@AxxionMarketPlace-iu6ri Жыл бұрын
Thank you
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН
Power BI Update - January 2025 | Modeling
8:31
Microsoft Power BI
Рет қаралды 2,5 М.
When to use Traits, Interfaces, and Abstract Classes in PHP
15:08
Andrew Schmelyun
Рет қаралды 25 М.
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 362 М.
All Rust string types explained
22:13
Let's Get Rusty
Рет қаралды 194 М.
PHP doesn't suck (anymore)
10:48
Aaron Francis
Рет қаралды 212 М.