8: Static Properties And Methods In OOP PHP | Object Oriented PHP Tutorial | PHP Tutorial | mmtuts

Поділитися
Вставка
  • Опубліковано 11 лис 2024

КОМЕНТАРІ • 137

  • @Dani_Krossing
    @Dani_Krossing  5 років тому +33

    Before any comments!
    Yes episode 9 is missing!
    I decided to remove my lesson about the "toString" PHP method, and instead I will upload an episode on "type declaration" soon enough.

    • @fr3fou
      @fr3fou 5 років тому +2

      You should pin this :)

    • @UnboxTek
      @UnboxTek 5 років тому +1

      can you please post the "PLAYLIST" link on the description as well? :) Thanks!

    • @khaledal-falihi7311
      @khaledal-falihi7311 5 років тому

      ❤😘👌

  • @RedBunny
    @RedBunny 5 років тому +61

    Dear fellow students/web developers,
    Make this channel grow and donate. These videos are better than a lot of the paid ones on Udemy and this guy is making it for free. I would pay for videos this qualitative in a heartbeat. Keep on going man!

  • @user-rx8lz6yz4f
    @user-rx8lz6yz4f 2 місяці тому +1

    Thanks for being one of the few UA-camrs to explain this properly. 👍

  • @karolispetrikas7798
    @karolispetrikas7798 4 роки тому +5

    This is how you teach. Relax, don't stress you students, don't use complex sentences and acronyms just to show-off how cool your are. I came here from a PHP bootcamp, where they thought they taught entire OOP in 3 hours... complete and utter joke. You a role model teacher!

  • @yungifez
    @yungifez 4 роки тому +14

    It is so joyful seeing mmtuts making mistakes.
    It reminds us that even the best makes mistakes so we should not be frustrated and think little of ourselves when we do so

  • @sistemasuniverso1461
    @sistemasuniverso1461 2 роки тому +1

    Son impresionantes tus lecciones. Jamás me fue tan claro este tema. Te agradezco infinitamente. Sos excelente educador!

  • @uchihamadara4340
    @uchihamadara4340 Рік тому

    I wish I had a teacher like you back then; it would have saved me a lot of time. Thank you, Daniel, for this amazing course. Keep up the great work!

  • @Michael-lo3ht
    @Michael-lo3ht 9 місяців тому +1

    Love this series so far. At first, on this one you caught me off guard for a second. I thought it sounded like you said Stetic. lol But then realized you said Static. After hearing you say it more it was clear. I love how you explain the reason why you stuff, instead of just telling you to do it. It helps to know why. Thanks

  • @0Apostata0
    @0Apostata0 5 років тому +20

    Hi there, love your vids! But could you also include real life practical examples in your tuts? Like creating user objects on register forms and saving them into a db or something like that? Often simplified tutorials just explain the concepts but never show real life examples of using OOP. It makes it a lot harder to apply, there need to be more practical examples. Thank you and great work!

  • @Ольга-ж5к4й
    @Ольга-ж5к4й 5 років тому +10

    Dude, I'm in love with you, sooo good explanations - that's a talent...

  • @kodelagi-daniel
    @kodelagi-daniel 5 років тому +4

    hi daniel. Im really grateful for your lessons. i learned more from you than from my school,
    thanks

  • @khusamalfas2121
    @khusamalfas2121 3 роки тому

    Dani, you are very simplifying it, and that's awesome, Do not worry most of the senior developers misspelling things and that normal in process. Keep it up it's worth the time you are spending.

  • @ChangeYourLifeForever
    @ChangeYourLifeForever Рік тому +1

    the first time after many years i understand the purpose of the STATIC in PHP

    • @davidvaho
      @davidvaho 3 місяці тому

      I'm wondering, If it is good usage to have non-static method checkDrinkingLegality() which compares private property age and static property drinkingAge, so after object initialisation with age 18, method returns false (18 >= 21), but then you can use that static method setDrinkingAge(18) and then, calling checkDrinkingLegality on that object returns true, because meanwhile value of static property of Class changed to 18.

  • @osraneslipy
    @osraneslipy 4 роки тому +3

    OOP is so freakin confusing, luckily we have you :)

  • @stefano5146
    @stefano5146 4 роки тому +1

    Your videos and teaching style is perfect for me, thank you!!

  • @ינוןאלבז-כ1ז
    @ינוןאלבז-כ1ז 5 років тому +2

    Wow you've done amazing work in this playlist.
    For a long time I've been trying to understand object-oriented programming
    and you're making it easy to understand for me.
    thank you dear!!!

  • @ThatoJChere
    @ThatoJChere 4 роки тому

    You changed my programming life for the better...Big up

  • @quasarkid4256
    @quasarkid4256 Рік тому

    This explanation was excellentl. Thanks for helping me understand this topic clearly

  • @smartwolf9045
    @smartwolf9045 4 роки тому

    wow...thanks very mutch man, exactly what I needed. You don't imagine how mutch it helps.

  • @bjornarmar2462
    @bjornarmar2462 4 роки тому +2

    I just facepalmed because I got this far without having subscribed yet.
    Fixed that issue!

  • @ivnstudios6135
    @ivnstudios6135 4 роки тому

    like a lot the tutorials, you explain very well Sr. Thanks a lot for making them, finally I am understanding PHP !!

  • @michaelbruce5415
    @michaelbruce5415 4 роки тому

    An excellent series on PHP OO Programming.

  • @AnimalChannelTube
    @AnimalChannelTube 3 роки тому

    Very good teacher. Good Tutorial

  • @MB-zj3er
    @MB-zj3er Рік тому

    Thank you for your videos, I have found them very helpful. 👍

  • @GarTheStar
    @GarTheStar 5 років тому

    you are a legendary teacher

  • @oghenevwefepeace2501
    @oghenevwefepeace2501 2 роки тому

    You are awesome man.. God bless you

  • @Coda02
    @Coda02 3 роки тому

    Thanks a lot I think I understand it now, so like a static is almost kind of like a global variable within a certain class

  • @mariavictoria5435
    @mariavictoria5435 2 роки тому

    Good job and explanation! Thanks a lot!

  • @daniel71626
    @daniel71626 4 роки тому

    Thank you, i really got it clear now.

  • @GarryThakur07
    @GarryThakur07 5 років тому +1

    Hey man, new subscriber here. Great course, Great way of teaching and setup. Am really gonna show these videos to my friends too as it's so good and clears up most of the problems we face. Also you look very much like Luka Jović :P

  • @jackt6112
    @jackt6112 2 роки тому

    Great explanation.

  • @geneartista9714
    @geneartista9714 4 роки тому

    Awesome tutorial as always!!

  • @thomask.7978
    @thomask.7978 4 роки тому

    I wonder what your technical setting is for such brilliant presentations. Clear voice, big HD screen, you standing in front of the screen i. e. one can hear and see everything easily. I'd appreciate it if you told us how you do this?!

  • @tonygonzalez125
    @tonygonzalez125 5 років тому

    Thanks man!
    Greetings from Brazil :)

  • @jaibodele6363
    @jaibodele6363 5 років тому +1

    video is really good and the content is also good.

  • @perfect.stealth
    @perfect.stealth 5 років тому

    Super gode og lærerige videoer

  • @Annak942
    @Annak942 Рік тому

    Oooohh *frontend dev taking notes*

  • @srdjagunjic
    @srdjagunjic 5 років тому

    Awesome tutorials Daniel! Keep it up

  • @vaishakhkp5612
    @vaishakhkp5612 5 років тому

    Really helpful budd, keep it up.

  • @siriusgd4753
    @siriusgd4753 5 років тому

    I learned something today!

  • @prsion1925
    @prsion1925 5 років тому

    Thanks for your sharing with us

  • @0x1stvan
    @0x1stvan 4 роки тому

    8:35 Best cut ever :D

  • @programmingtestsandproje
    @programmingtestsandproje 3 роки тому

    thank you so much

  • @nawalnitsua8893
    @nawalnitsua8893 4 місяці тому

    @Dani_krossing can I summarize by saying static methods and properties are those that do not vary from object to object at instantiation from the class?
    As in it's said to be static because it's same for any object instantiated from that class

  • @hayatzee8830
    @hayatzee8830 2 роки тому

    Thank you!

  • @mangeshsathe
    @mangeshsathe 4 роки тому

    Good explanation!

  • @hitzjoshi1875
    @hitzjoshi1875 5 років тому +1

    Hy Is It Possible in Php
    when internet is not available then it will save as local system data and when ever internet is access then it will sync data to database phone admin?

  • @alex_3D_websites
    @alex_3D_websites 4 роки тому

    Keep up the good work!

  • @bikramneupane1818
    @bikramneupane1818 5 років тому

    You tutorial is very well

  • @birdhousegypsy3655
    @birdhousegypsy3655 3 роки тому

    no drinking age! That sounds awesome! haha!

  • @issaissifou4959
    @issaissifou4959 2 роки тому

    Thank you so mach.

  • @bigdog3386
    @bigdog3386 5 років тому

    You are an awesome guy!

  • @sumanbd77
    @sumanbd77 Рік тому

    Awesome
    Thanks a lot
    ❤❤❤❤❤

  • @srijanlama6446
    @srijanlama6446 5 років тому +1

    if u would make the video series in dependency injection and modular programming in php then that would be super great

  • @abolfazl3273
    @abolfazl3273 8 місяців тому

    Nice ❤‍🔥

  • @AxxionMarketPlace-iu6ri
    @AxxionMarketPlace-iu6ri Рік тому

    Thank you

  • @ChandraTech52
    @ChandraTech52 5 років тому

    Thank you so much things making so easy, learned a lot ❤️❤️❤️

  • @Jay-eg7yt
    @Jay-eg7yt 5 років тому

    Two thumbs up on the video. In the static example being used the property is public. I am curious to know if it is possible to do this using a private static property and if so, in what type of situation would it best be suited for?

  • @spiderangelo
    @spiderangelo 3 роки тому

    Good Tutorial... But want to inform you about some errors. there are errors where you create function getDA, also when you are accessing it!

  • @autopilot7953
    @autopilot7953 5 років тому

    hi, have been subbed a while now and i can say you are the best teacher and you talk so clear and understandable,thanks!I am having some problems with my website (php, js) and i want a little help from you,could you help me?

  • @leonf.7893
    @leonf.7893 3 роки тому

    I don't feel so bad about creating static classes any more. I used to only create helper methods as static because I had this notion that static methods were some kind of bad thing.

  • @srijanlama6446
    @srijanlama6446 5 років тому

    nice work brother keep up the good work love from nepal

  • @tloulehlohonolo06
    @tloulehlohonolo06 4 роки тому

    Good day may you please explain to me when do you use public, private and protected in php

  • @Marxone
    @Marxone Рік тому

    I don't get it.
    I mean, i can call non static method with (new Class)->method(); , but when I don't need the rest of the context, it is cleaner to just use Class::method() ?
    For example if I have just some support functions that are used across the project?, and the inheritance structure isn't suited to have it just once on the highest level?

  • @tdias25
    @tdias25 4 роки тому

    you look like elon musk, great tuto btw

  • @priyranjansingh2792
    @priyranjansingh2792 4 роки тому

    Nice video

  • @talkohavy
    @talkohavy 5 років тому +1

    Question:
    What about Static Classes?
    What do I do when I have several classes which all need access to the same Static Class that holds all the information?

    • @khatau
      @khatau 4 роки тому

      I don't think there is anything like Static Class. The concept of Static is to access properties and methods without creating an object, or without inheriting an entire class just to access one property/method.
      Separately, if you have several classes that need access from one class (that one class is a 'parent' class by the way... you don't have to declare it a parent class though), then you need to inherit.
      Check mmtuts' 4th video on "visibility and inheritance".

  • @juulmorten
    @juulmorten 3 роки тому

    I think the way i remember static is that it affects all objects of that class, so if you change the drinking age then it will be changed for every object.

  • @flifluflofli
    @flifluflofli 4 роки тому +1

    There is something i miss cause i tested to call static method and actually I can call them from the instance Object build from the Class ( so the static is not static ?) and I can also go with static way as u say calling inside the class I reach both with no problem.. but when it is a proprety it react differently ?

    • @paulbrugger9610
      @paulbrugger9610 2 роки тому

      If you change a static property to a regular class variable then each derived object could have a different value....

  • @taet6882
    @taet6882 5 років тому

    hi dear thank you for your great tutorials! appreciate it !
    because i couldn`t find anyone in whole internet and tutorials who can teach like you!
    will you gonna make videos about : namespace ,abstract, autoloader ..... and other oop functions and concepts that are in php manual ????
    thank you!

    • @Dani_Krossing
      @Dani_Krossing  5 років тому +2

      Thank you! autoloader is already created and scheduled for upload on Monday :) Abstract classes and methods will also soon be a video. I am going to wait a bit with Namespace.

    • @taet6882
      @taet6882 5 років тому

      @@Dani_Krossing thank you very much .i will wait !

  • @moldovandorin6187
    @moldovandorin6187 5 років тому

    what a nice guy :)

  • @webteches
    @webteches 5 років тому

    thanks sir

  • @astrosoup
    @astrosoup Рік тому

    One point of confusion. If you update a static property, will it go back and update the same property for $person1, $person2, etc.. Will it also use the new value for any newly created $person objects after this?

    • @Dani_Krossing
      @Dani_Krossing  Рік тому

      A static property isn't object specific, and will change all existing or future objects, since they reference to the same data. 🙂

  • @arsalarsi7858
    @arsalarsi7858 3 роки тому

    What if i want to know how many objects were created for the class without using "__construct" maybe with get_called_class???

  • @lesastucesinternetdemuriel1026
    @lesastucesinternetdemuriel1026 5 років тому

    good job

  • @dfordemo981
    @dfordemo981 3 роки тому

    "we cannot use the static property inside nonstatic method" right??

  • @ehtishamjadoon2003
    @ehtishamjadoon2003 5 років тому +1

    Sir kindly make a vedio on CRUD system in oop php

  • @TheJDieJ
    @TheJDieJ 5 років тому

    is public static similar to const in js?

  • @BigStance
    @BigStance 5 років тому

    Can I ask you to film a series of php oop register form programming? :)

  • @Mehrdad_Manouchehri
    @Mehrdad_Manouchehri 5 років тому

    THanks

  • @calin6327
    @calin6327 5 років тому

    You moved such a long way

  • @English101withTony
    @English101withTony 4 роки тому

    nice, but why you didn't mention (self::) ?

  • @MhmmDonuts
    @MhmmDonuts 5 років тому

    Can u make a tutorial about how to upload files in MVC pattern using ajax on a action controller? Or how can I pass the file I get from ajax for example $model->fileUpload($thjs->getPost['file']) argument to any function in any class? I couldn't find anything help me plss haha

  • @trravelog-t5
    @trravelog-t5 4 роки тому

    Hey Daniel, you have awesome courses, I got a very good understanding of OOPs from your video. I was trying something locally and not able to crack it, i know its simple but for some reason its not working.
    I have an index page and a class file. In class, I have defined it something like this
    Class ABS{
    private $var1
    private $var2
    private $var3
    public function function1(){
    Some SQL query which return an iD
    //from the array i get the below ID, and when i do an echo here it shows the id as well
    echo $ID = $this->var3 = ID['SrID'];
    }
    public function function2(){
    echo $ID; //doesnt work
    //basically trying another SQL here with the ID I get in function1//
    }
    )
    so how can I get this variable from function1 to function2, I tried a lot but did not work, so for now what I did is, in the index file I got a return from function one and then I have passed that ID to function2 in index, something like below
    $classvalue = new ABS();
    $ID=$classvalue-> function1();
    echo $classvalue-> function2($ID);
    wondering if there is an easy way to it.

  • @UnboxTek
    @UnboxTek 5 років тому

    where's the link of the PLAYLIST of these tutorials? :)

    • @Dani_Krossing
      @Dani_Krossing  5 років тому +1

      On my channel page there is a link to all my courses. But you might be right about that there should be links under the video as well, so I will do that :)

    • @UnboxTek
      @UnboxTek 5 років тому

      @@Dani_Krossing yes please :) for us to bookmark it, cause currently what is indexed or displayed on your YT page is the older version of the tutorials.
      TIA!

  • @Mercio2
    @Mercio2 4 роки тому

    nice

  • @ademottoman962
    @ademottoman962 5 років тому +2

    Hi can make some flutter videos

  • @selimeneskaraduman6935
    @selimeneskaraduman6935 4 роки тому

    How can I thank you man :( ? You taught me lots of things thanks!!! really

  • @PanlasangMotour
    @PanlasangMotour 5 років тому

    Do you have a tutorial on How to Create A Membership System Using PHP and MySQL Tutorial with email verification ?? Thanks a lot :D

  • @alsur272
    @alsur272 4 роки тому

    by the way :: in Php is called "Scope resolution operator"

  • @mahdisharifi5989
    @mahdisharifi5989 5 років тому

    thanks for this video , but i did not understand that when we must use static keyword

  • @ademottoman962
    @ademottoman962 5 років тому +2

    hi can you nake a live stream the last one i loved it

  • @WideEyesChannel
    @WideEyesChannel 5 років тому

    Dude I like you're teaching method.. do you have a Twitter account?

  • @edieperdana2101
    @edieperdana2101 3 роки тому

    I can't find video number 7

  • @rohankhode4200
    @rohankhode4200 4 роки тому

    When i run these code it shows me error:
    Notice: Undefined variable: setDrinkingAge in C:\xampp\htdocs\oop\index.php on line 20
    Fatal error: Uncaught Error: Function name must be a string in C:\xampp\htdocs\oop\index.php:20 Stack trace: #0 {main} thrown in C:\xampp\htdocs\oop\index.php on line 20
    public static $drinkingAge = 23;
    public static function setDrinkingAge($newda){
    self::$drinkingAge = $newda;
    }
    echo Student::$drinkingAge;
    echo Student::$setDrinkingAge(93);
    echo Student::$drinkingAge;

  • @maxiequa567
    @maxiequa567 5 років тому

    Would you be interested in making a video on Paypal integration? Seems a lot of people are looking for it these days.

  • @zehnagel6556
    @zehnagel6556 5 років тому

    You should be aware that public static variables ($drinkingAge) can be changed from anywhere (during code execution), and this change affects all instances that use this static variable. They are some kind of scope-less.

    • @Dani_Krossing
      @Dani_Krossing  5 років тому +1

      That's right! You tell them Zeh! ;)

    • @f0ru0l0rd
      @f0ru0l0rd 4 роки тому

      @@Dani_Krossing So... maybe I'm dense, but question: Why use this instead of a hard coded property?
      I'm thinking (though it WASN'T explicity said, so I could be wrong), is that if say I had an object of Dog, and it's latin name changed, if I did Static, all my objects (old and new would be updated automagically? Is that correct, or am I misunderstanding this?

  • @mwgmedia2378
    @mwgmedia2378 5 років тому +2

    First comment here :)

  • @romeoasif
    @romeoasif 4 роки тому

    that colon colon is actually called a scope resolution operation -_-

  • @augischadiegils.5109
    @augischadiegils.5109 3 роки тому