Basic PHP Syntax - PHP 8 Tutorial

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

КОМЕНТАРІ • 174

  • @ZoricaStojicic-n9v
    @ZoricaStojicic-n9v Рік тому +13

    I highly recommend this video on the Basics of PHP Syntax to total beginners and anyone who lacks a clear starting point, as it is truly helpful.

  • @MehdiEm
    @MehdiEm 2 роки тому +9

    Wow ... the amount of information you have is insane!!! It shows that you really know what you are talking about. Thanks for this valuable series! :D

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

      Thank you. I spend a lot of time preparing videos, I don't know everything by heart :)

  • @lairotuT-Tutorial
    @lairotuT-Tutorial 23 дні тому

    Great Video and great Tutorial Gio!
    I have a bit knowledge about PHP but I guess with this tutorial series I could dive a bit deeper.
    I have heard many people telling that they use echo in php or that echo is better than print and I already knew the different behaviour in most cases. But noone by now told me that echo is faster. I immediately programmed a small test:
    With 500.000.000 function calls I was able to examine a 2-3% time effort. So, you are right, it is faster but I guess that should not matter in a normal project. Still it is true to use the functions / tools you really need and not those that do extra stuff you ignore anyways. But I guess that might be more important for more complex functions and when using any framework, there runs so much extra effort in the background that I doubt that echo/print makes a big difference. But still thank you soo much as I now KNOW why I always use echo although I was so familiar with print from C-times 🙂

    • @lairotuT-Tutorial
      @lairotuT-Tutorial 22 дні тому

      I will follow your actual Laravel course after finishing this one. And after this I hope you will do an update on this course again 🙂If you consider that, I might have something for you:
      While testing, I compared single versus double quotes as well and I was astonished as double quotes were 20% - 33% slower than single quotes. Although these tests were not really representative as I only used 150 Million calls and due to the extreme fast calculation time of each single echo/print other factors like Server related delays might have had huge side effects. But still I guess its even more important to use single quotes instead of double quotes than to use echo instead of print whenever you don't need the other one explicitly. Maybe I will do more runtime tests like this 🙂

    • @ProgramWithGio
      @ProgramWithGio  22 дні тому

      Thank you, yea most of those are negligible usually but it can add up

    • @lairotuT-Tutorial
      @lairotuT-Tutorial 21 день тому

      @@ProgramWithGio I wonder why in so many areas in programming time doesn't make a difference anymore. I can remember the discussions when there were those only programming with C as it always produced the fastets result and those that called C a dead language as the process of programming itself became that easier and faster with new languages. Yes the machines became much faster and were capable to handle "slow" code. But we now are in times where the apps with AI and deep thought become that complex that the small parts - as you mention - 'add up' drastically.
      I currently think about a project enabling an AI to change/reprogram itself with the force to switch between different languages and the ability to self-driven comparison of different ways and attitudes based on situation, aim and given ressources. But I know its too high goal for a single person project and as I am not professional programmer I guess I have to wait for a company that has these goals and wants noobs like me for their team just for the ideas 🙂

  • @SoniaChavez-je7hq
    @SoniaChavez-je7hq 7 місяців тому

    Very helpful tutorial ❤

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

    i have started learning it i will come back when i finish it! 😄

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

    very good, i'm wathching from Brazil, thank you.....congratulations for your channel!

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

      Thank you & greetings to you my friend, love Brazil (my favorite national football team)

  • @alexsavastru8125
    @alexsavastru8125 2 роки тому +29

    Well, considering I'm currently in an internship and trying to catch up to my mentors, this series is an absolute gold mine. One of my mentors recommended it and I couldn't be more satisfied by it. Thank you for the invaluable work you put into this!

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому +7

      Thank you & send my thanks to your mentors, really appreciate it 💙

    • @keshiiiiii
      @keshiiiiii 2 роки тому +2

      Same 🤭

  • @ahmedyasser571
    @ahmedyasser571 6 місяців тому

    thank you so much

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

    great. thank you.

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

    thank you

  • @stefanbirsan3320
    @stefanbirsan3320 3 роки тому +1

    great!

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

    Hi I am a completely beginner for PHP, but the tutorial is really too fast for me :( a bit frustrated

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

      Hello. You can slow it down by clicking on the ⚙️ icon and set playback speed to 0.75x or 0.5x. I apologize if it's too fast, I've made some editing mistakes where I cut out all empty spaces.

  • @AlexeySuzdalenko
    @AlexeySuzdalenko 9 місяців тому

    i am study inglish language in this video

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

    ❤️❤️❤️❤️❤️

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

    How to make errors to appear in a browser? I've edited php.ini file and set error_reporting = E_ALL and display_error = On, but nothing changed. The program is still crashes silently.

  • @ნოდარდავითულიანი

    ქართველი ხარ ხო ? დ

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

      კი 🙂

    • @ნოდარდავითულიანი
      @ნოდარდავითულიანი 2 роки тому

      @@ProgramWithGio აქცენტზე გეტყობა დდ
      პ.ს. მშვენიერი კაი საქმეა, ისე ქართულადაც რო დადო გამოგვადგება ბევრ დამწყებს

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

      @@ნოდარდავითულიანი მადლობა. ქართულად გამიჭირდება რადგან ქართულად არ მაქვს ნასწავლი მე თვითონ 🙂.

  • @younickbongo7870
    @younickbongo7870 3 роки тому +1

    you know what you don't deserve???? a dislike. nice video.

  • @gazianis7572
    @gazianis7572 3 роки тому +10

    php file:
    If you want your file to be interpreted as php then your file must end with that php and not with that html. php files can also have html, CSS, JavaScript in them.
    php tag:
    php opening and closing tag is and php interpreter interpreted the code between opening and closing tag. But if your file entirely contain 100 percent php code then you do not need the closing tag and that is to make sure that no accidental whitespace or new lines are added after the php closing tag which could mess up your website.
    Semicolon:
    php closing tag will automatically assume the semicolon on the last line.
    So basically you do not need semicolon the Last line of php statement. This is useful when you are embedding php with html and it's just a single line in those case s you do not need the semicolon but if you have multiple lines though it's a good idea to stay consistent and just use the semicolon.
    php code execute:
    You could execute your php script within your terminal. If you open xampp control panel and click on shell on here this will bring up the terminal. We need to cd into our project directory which is htdocs program with project name and then you could run php files using the php command and that will give you the output. So you could basically execute your php code in command line if you want.
    You could also use print to print something which essentially is the same thing as echo.
    Difference of echo and print:
    Print has a return value of 1 for that reason here I give an example like
    I do echo and then print that will print out hello world and then append one at the end because this expression itself return 1 this means that print could be used within expressions while echo can not for example if we did this the other way print echo "hello world" and this would not work and we would get the syntax error.
    Echo could print multiple values while print can not.
    for example
    echo "abc", "xyz";//works
    print "abc", "xyz";//does not works
    Echo is marginally faster than print.
    variable
    Vraible declared with dollar sign($).First character start with a-zA-Z_ and then other character from a-zA-Z_0-9.No space and no special character are allowed. This is a object so you do not assign $this.
    Variables in php are by default assign by value .Let me show you what I mean
    so if we have a variable called x which equals to 1and then we have a variable y which equals o x and then we change the value of x to 3 and then we print y what will be printed is 1 and not 3 that is because variables are assigned by value.On the other handif you actually wanted y to change whatever x cahnges then we need to assign variables by reference instead of value. Assign a variable by reference,you need to add ampersand righ here so now y is equal to reference variable x so anytime x cahnges the y will also change and now y is equal to 3.
    Comments:
    There are two types of single line comments that are // your comments and #your comments.
    Multiline comments is /* comment here */. Nested multiple comments are not allowed.

  • @lynic-0091
    @lynic-0091 2 роки тому +10

    This will help out beginners immensely, I wish I had these basics when I just started, would've helped me out a lot!

  • @thechoosen4240
    @thechoosen4240 11 місяців тому +2

    Good job bro, JESUS IS COMING BACK VERY SOON; WATCH AND PREPARE

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

    holy shit you went with php storm. Great software but expensive as heck and probably not something a new user would invest in.

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

      Sure, you can use whatever IDE you want, phpstorm is not a requirement. It's just what I use and am comfortable with

  • @kewl-asian
    @kewl-asian Рік тому +7

    These are legit the best coding practices I have ever learned, and you just tackled printing and variables. I'm commited to finish this tutorial :)

  • @michaligocki35
    @michaligocki35 3 роки тому +9

    lots of great stuff, very detailed. you're the best PHP teacher I've ever encountered.

  • @cristianvulpe1408
    @cristianvulpe1408 3 роки тому +5

    That's awesome, I really love your teaching style. Keep up the good work.

  • @Vitalii-m6r
    @Vitalii-m6r Рік тому +4

    Learning PHP language is very pleasant thanks to this channel.

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

    wcan i get like to the creator of this video,im learning php anow, im am lat?

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

      I'm the creator of the video, what's up?

    • @lairotuT-Tutorial
      @lairotuT-Tutorial 23 дні тому

      although its hard to read your words. I guess you ask if you are late...
      In regards to the comment: 2 years after the video is late but not too late as I guess, especially as the creator himself replied 🙂
      In regards to learning PHP: It's never too late to learn new stuff and PHP is still really active as Gio explained.
      So I would say no, you are not too late. In the end, I am even later on both points 🙂

  • @spencersedano
    @spencersedano 10 місяців тому

    Many jobs opportunities using PHP from where I am located. I was learning Node.js and I will still practice it but I feel like I should learn PHP and not pay attention to those who say that PHP is dead.

    • @ProgramWithGio
      @ProgramWithGio  10 місяців тому

      Thats a good strategy, you should go based on demand & if in your location PHP is on demand then it makes sense to learn PHP

  • @SynMlyn
    @SynMlyn 8 місяців тому +2

    Huge thanks to Gio for the invaluable knowledge shared in these tutorials!

  • @a7medalyousofi
    @a7medalyousofi 2 роки тому +2

    The best explanation way I have ever attended on UA-cam, a lot of information that I did not find in another youtube channel, I really like your way of explanation.
    Thank you, Gio.

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

    This is the third tutorial I'm on, and I had to quit the other two (which are supposedly for beginners), because of deprecated code and no fix for the problems. One thing I wondered was why there was no php closing tag used. Nobody ever explained it. You are the FIRST to actually explain why! Thank you!!!

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

      It's one of the reasons why I made this course and put in so much effort. Glad you like it and find it useful, feel free to ask any questions as you are going through the course 🙌

  • @magnus6881
    @magnus6881 Місяць тому

    Very useful tutorial to start with PHP. I'm coming from Java world, so it shouldn't be that hard for me to learn php in few months I guess :)

    • @ProgramWithGio
      @ProgramWithGio  Місяць тому

      Thank you. Yea if you know Java it shouldnt be that hard

  • @user-Des3
    @user-Des3 7 місяців тому

    Hi, there. I am absolutely new in this. I have already installed VSC, is it ok for php? You didn't recommended in the video...

    • @ProgramWithGio
      @ProgramWithGio  6 місяців тому

      It's fine, I don't use VSC, I use phpstorm but a lot of devs use vscode & I think its fine. It just may not have all the features phpstorm has.

  • @AlizetaKonate-v7h
    @AlizetaKonate-v7h Рік тому

    Hello ,pleasehow can i fix the port problem definitly in xampp,cause all the time i open xampp i have to change port number

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

      Maybe something else is running on that port that is holding it up?

  • @rustlejack9542
    @rustlejack9542 3 роки тому +2

    Hey Gio! You deserve Millions of Subscribers. Keep it up and bring more courses like this 'cause I'm really enjoying this course.

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

      Thank you, I'm glad that you like my tutorials 🙌

  • @FritzLloydLagare
    @FritzLloydLagare 9 місяців тому

    can i use vs code as IDE while following ur tutorial?
    beginner here thank you

    • @ProgramWithGio
      @ProgramWithGio  9 місяців тому

      You can use any code editor you like

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

    Can you please confirm that the link to your patreon account works? I hit the url but it seems to be broken or something.

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

      Yes works fine on my end, just tested it as well

  • @954roof
    @954roof Рік тому

    Working on a laravel project and struggling with syntax hope this will help

  • @MaximFyodorov-v4s
    @MaximFyodorov-v4s Місяць тому

    Help me please! When i ran programm on VS code notification comes out: 'PHP executable not found. Install PHP and add it to your PATH or set the php.debug.executablePath setting'. What can i do with that?

    • @ProgramWithGio
      @ProgramWithGio  Місяць тому

      How is your PHP installed? I dont use vscode so Im not sure how its configured there but it simply means it is looking for php executable and cant find it, if you are running php through wsl2/docker then you need to select php executable from there

    • @MaximFyodorov-v4s
      @MaximFyodorov-v4s 26 днів тому +2

      @@ProgramWithGio I just forgot to download php. Everything is working now. Thanks!

  • @snakemanluffy7645
    @snakemanluffy7645 3 роки тому +1

    Thanks. I didn't know about the reference. Looking forward to finish this amazing course :P

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

    How did you make the browser auto update the output of the code?

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

    hard to follow examples, your screen is too small

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

      Yea, I realized that a bit late. In section 3 it gets better since I zoom in a bit and also I zoom in on parts that are important.

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

    Srry boys but echo ("Hello {$variable}") is deprecated since php 8 so if you are searching why vscode gives u a warning in this line of code now you know why

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

      Nope, that is not deprecated in PHP 8 and is perfectly valid. Did you define the variable? What error are you getting? Maybe you are referring to PHP 8.2 which deprecates this: "${variable}" but "{$variable}" should still work

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

      @@ProgramWithGio works but vscode says it's deprecated since php 8

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

      @@teacupentertaining6073 I don't see it in the php documentation as being deprecated. You can see here what's deprecated in 8.2: www.php.net/manual/en/migration82.deprecated.php

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

    I was a bit confused at first until I realized that you do not know the meaning of the symbol quotes in English. ' = apostrophe, " = quotes and "" = double quotes.

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

      Thanks, English isn't my first language, but in PHP we usually call it all quotes (single, double) and saying apostrophe usually confuses people more since most know it as "quotes" and either single or double quote works in most cases.

    • @lairotuT-Tutorial
      @lairotuT-Tutorial 23 дні тому

      PHP uses American English only. In whole programming world only single quotes and double quotes is usual.

    • @almoemason
      @almoemason 22 дні тому

      @@lairotuT-Tutorial So. What is your point?

  • @saikumar-cd5zz
    @saikumar-cd5zz Місяць тому

    ur the person we need buut dont deserve

  • @victorpinasarnault9135
    @victorpinasarnault9135 3 роки тому +1

    Real Nice!
    Liked and subscribed.

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

    echo print('!!');

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

    Joel Karr to be fair I learnt loads

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

      Was this directed to me or someone else? Either way, thank you 💙

  • @ahmadyounis6814
    @ahmadyounis6814 10 місяців тому

    Perfect explanation 👌

  • @GeneralStaal
    @GeneralStaal 10 місяців тому

    I have been developing in PHP for some years . . . and didn't know about ONLY have an opening PHP tag, for files that ONLY contain PHP. A great tutorial.

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

    very powerful tutorial :)

  • @migueldemaria3830
    @migueldemaria3830 3 роки тому +1

    learning lots of cool little details here!

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

    TNice tutorials comnt from you is legendary. Uncomplicated like your video!!!

  • @DHADUKPARASKUMAR
    @DHADUKPARASKUMAR 9 місяців тому

    Thank you for this wonderful and very knowledgeable 🙏 PHP learning series.

  • @zonegamma8197
    @zonegamma8197 5 місяців тому

    thanks a lot

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

    I like how you speak slowly and explain everything . I will complete the full course .. Keep up the good work

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

    thank you again

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

    U are the best ❤

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

    Very Clear. I liked your introduction and how detailed you are. Starting right at the beginning is frustrating but absolutely necessary as you say

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

    Very clear explanation you deserve more audience.
    You earned a new subscriber.
    Keep up the good work 😍😍

  • @vladimirputindreadlockrast812

    You can also use a period to concatenate a string: $s = "Hello " . "World";

  • @AhmedShehtaShe7ta
    @AhmedShehtaShe7ta 3 роки тому +1

    Keep up the good work. ❤

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

    Awesome :)

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

    Hi Gio. Nice videos. I created php functions to be used to generate dynamic html but i feel is the wrong practice. I watched your videos on slim and twig but couldnt wrap my head around so im using php template for the view rendering. Is there a way i can use slim php with React (acting as the dynamically generated html for the views) where if render view eg home.php with some fetched db data the React takes the $data which I'd json encode in the home.php view and pass it as a prop to a React component to dynamic generate the views. In short how can i merge slim php with react

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

      You can use PHP with React but you would need to use PHP as an API layer and pass data to your react via ajax calls. Its a bit complicated to set it up but its certainly possible. You can look into Inertia.js for Laravel which allows you to pass down to react components directly from controllers similar to how you would pass it down to regular views

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

      @@ProgramWithGio this is great! Thank you, mate.

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

    Php8?

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

      Yup, we upgrade to PHP 8, & to 8.1 in following videos. At the time of recording of this video 8.0 wasn't released yet.

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

    Is there a reference that gives us a list of course in order of the video names?

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

      Yes, the link to the repo is in the description. It contains outline of all videos with title and link

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

    Once again, very clear and nicely explained. Plus, I enjoyed learning the concepts that are not very widely taught in other resources. keep it up! :)

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

    thank you very much for this excellent course.

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

    Thank you for your great contribution !!

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

    finally i found a good PHP course.

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

    great tutorial. Thanks

  • @k.bharathkempula6896
    @k.bharathkempula6896 Рік тому

    very clear explanation sir

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

    Good for beginners.

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

    Hi Gio, one thing about the semicolon, I saw in following videos that when you declare function or classes you don't use the semicolon at the end, why that? Isn't it an end of a statement?Indeed if I put it in those occasions it seems that the script doesn't work, I'm quite confused.

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

      Hey, you don't need semicolon at the end of }. Can you point me to timestamp on the video on what part you are referring to? You don't need semicolon on single line expressions like this

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

      @@ProgramWithGio
      I didn't mean u put semicolon at the end of }, I was askin' why is that in general.
      "Hey, you don't need semicolon at the end of }" --->why is that? I can't understand where to put semicolons exactly.
      I meant that in following videos of yours there were (indeed) no semicolon at the end of } but I cannot understand why if we're saying that we must put them after every statement.
      There were something like this(but also seeing other codes):

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

      @@rosarioveneruso9928 } on its own is not a statement so yea you don't put a semicolon there. It's just a closing bracket. If that were case then you would need to put semicolon at the end of each line including the if() {.
      P.S. I don't think the above code is from my lesson.

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

      @@ProgramWithGio It isn't , i was just an example(i wrote "somethin' like"), the point was that it wasn't clear to me when/where put semicolon.
      "} on its own is not a statement so yea you don't put a semicolon there" I meant the two brackets with what is inside of it, don't we count that as a statement? The block inside of it is not a/a series of instruction/s?

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

      @@rosarioveneruso9928 I would watch lesson about expressions in this series, it might help. You just don't put semicolons at the end of brackets, idk if there is a list of things that you can't put semicolons on but that's one of them. Whatever is contained within control block (within brackets) at the end of those lines you put semicolon, they are usually expressions.

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

    Realy cool

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

    Great Master

  • @alnahian2003
    @alnahian2003 Рік тому +2

    Wow! I just learned that in PHP variables are assigned by value by default and not by reference 😮
    Already seeing some progress, can't wait for more 🎉

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

    pls which text editor is suitable to code php

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

    Excellent! Thanks, Gio!

  • @motiv8street
    @motiv8street 7 місяців тому

    Thanks a lot

  • @Islam.our.religion
    @Islam.our.religion Рік тому

    Thx for the great video