For all you new people out there reading comments, PHP is super valuable to learn right now. There are a plethora of jobs needing PHP developers to maintain old systems. Much easier to get a job in php, than to try and get a job in a newer language/framework.
@@kidzeezy0112you should know how to use google. This is the most basic fundamental skill. I am not looking down or mocking you. Train your brain to think of solution first, go to google second. Say to yourself "others will google the answer to tell me. I am not blind. I can search myself too"
@kidzeezy0112 I would recommend using traversy media's front to back series for php then when you're done with that and have a good understanding of what it's all about and build a few projects with php I'd advice you go on and learn the laravel framework👍
I've been a PHP programmer for 22 year. (Yes, since 2001, version 4-something). The language has changed a lot in that time. At the beginning it was very similar to Perl and C, now it's more like Java. Lately however, in my company, some projects are being rebooted in C# and new stuff tends not to be done with PHP at all. I feel like PHP is declining in popularity, which makes me a little sad because I really like the language and I have no interest in C# and all the Microsoft associations that come with it.
.. i would never use php outside of context of Laravel lol... there's very little reasons to use php tbh... php/laravel is good for todo apps... ever seen anything more built with it? : ))) php servers keels over faster than a node server... backend in node/php is error on itself... just use Go or Elixir for backend or something else...
@@Microphunktv-jb3kj The problem is that you cant use Laravel without knowing php. Or better, you can...but you will write something you dont understand deeply.
Beware: you cannot access variables you declared in your file from inside a function UNLESS you re-declare them in the function with a global prefix. Example: ```php $var = "foo"; function boo(){ echo $var; } ``` Will not echo the string foo because of scope. It will be null basically as the function cannot see the one declared outside. Unless you add a global $var in the function like this: ```php $var = "foo"; function boo(){ global $var; echo $var; } ``` Will echo "foo" as intended. You can also pass by value like bo($var) but that is obvious
The reasoning behind this behavior is rooted in the way PHP handles variable scope. By default, variables within a function are considered local to that function. To access a global variable inside a function, you need to use the global keyword to explicitly indicate that the function should use the variable from the global scope. This design helps prevent unintended side effects and makes the code more modular and easier to understand by clearly delineating where variables are defined and used.
Question, folks. I've been writing desktop applications in C# for 10 years. I want to move towards web development. There is scalability and microservices... really eager for it. Employers see that I have no practical knowledge in this area and turn me down. But I can potentially get a position in PHP. Should I go for PHP? Thank you very much, your answer is highly important 🙏
Not really... you can do it, but other language can do it better. Such as multithreading support. The core design of php is limited to a single thread Web service app and fiddly to write concurrent, multithreaded applications. And the industry is moving towards machine learning/mathematical models. Developing in PHP and other capable languages such as Python is not practical. Also, a lot of cloud/distributed computing/ platforms have Python interfaces, such as Spark, airflow and more. So it's only natural to gravitate towards a single language that does all that compromising on performance if you are low on human resources or reduce cost...
Well, expressions have types, and can have the "mixed" type, but standalone variables don't. You can enforce types of function arguments and properties etc. with type declarations. More details here: www.php.net/manual/en/language.types.type-system.php
Absolutely, it's still one of the most used languages out there for web development. Mostly because it's so widely supported - it's available on almost all web hosting. Plus it's very simple to pick up and start using, and WordPress (which runs a huge proportion of the web's sites) uses it. So definitely still worth learning and you can get a decent job with it.
Yes, in the last decade and especially the last few years it has improved dramatically. Many features were added to make it easier, nicer, and cleaner to write code, and the performance increased over 4 times. Couple that with composer for managing packages, git, and Laravel framework for making websites, it's a pleasure to code in. There's many big companies using PHP, including Facebook. Also about 80% of all websites on the internet are still using PHP. You can get a decent job, yes, given that a vast majority of sites are using PHP. Even if you decide to switch later, you will learn lots of concepts from PHP and Laravel that are applicable in other languages and frameworks. On average, it's not the most paid job, but that's probably because of all those sites.
Since I’ve seen people saying we should use === I’ve always had the reflex to use 3 of them instead of two, I don’t really know what difference it makes though, but if it helps have a more solid code, that’s still worth it anyway
@@cedrictheveneau9141 Anyone who might be wondering: “2” == 2 will be true. (Sorta equals) “2” === 2 will be false. (Exactly equals) The == will perform type coercion if it has to. Which is why “2” (a string) and 2 (an integer) will become true. It’s easier to run into bugs if you don’t fully understand it. That’s why === is almost always the best option.
Ehh i dont agree, Yea u can use it that way but its not only way to use it ( also i almost never writed it in html in my 8years of php backend dev ) For example imports, exports, apis, …
Lol 😂 are u fr ? You must change title to 1990s you have completely ignored the entire new system of php that the new frameworks like laravel are count on PHP OOP
Thank you for the feedback! The idea of this video was to cover the syntax basics that are necessary no matter whether you're using a framework or not. I did what I could in 60 seconds (the maximum time for a RU-vid short). I'll cover OO and Laravel in further shorts though.
Bit difficult to say without more details - check your files are named with ".php" at the end, and that they're in a folder you have permission to read from
@@dave-hollingworth yes but it's a self-hosted server with a free domain and local host tunneling...I switched from running plain NGINX to running off Laragon which included php in the environment so that I couldn't install or get php to work in the local host myself or in NGINX even tho it has it.
"To concatenate a string we use a dot. " No. Don't. Please don't. Use sprintf. Use printf. Hell, use a fucking array and join. Just please don't use dots.
Well, you can type hint function arguments and properties, which will create an error if you pass a varable that contains a value that doesn't match the type hint. However you can't specify that a variable contains a specific type unfortunately.