Re: Which Php 7 Tutorials Do You Recommend To Complete Beginners?

Yes, there is procedural and OOP. Either style could be used in 5 or 7.

Ah! But which tut mentions they’re teaching OOP ?
Tuts available alright without mentioning if they are teaching OOP or Procedural. I’ll pick a famous site and then at the end realize they taught old timer procedural. And, famous sites hardly bother replying to your questions. Get my point ? I don’t think even php.net mention what they are teaching. Probly not teaching OOP like everyone suggest I learn that. And so, back to square one again going round in circles. Will have to stick to php.net and just learn any old crap they throw. What do you say ?

Clearly the tutorial approach is not working for you. Which is fine. Lots of ways to learn how to skin a cat.

Consider picking a project and then trying to implement it using one of the more supported frameworks (perhaps Symfony or Laravel) . Try to follow their recommended practices as much as possible. And then ask specific questions when you need to.

Until someone is able to build a simple application in just PHP, I would not recommend that they start using a framework such as Laravel or Symfony. For sure, pick a project and try to implement it - but from the ground up. And once they have a good solid foundation in the language, it is time to move on to frameworks and libraries and all those resources that will help cut corners and make the job easier.

@uniqueideaman, php.net is PHP’s documentation, to be used as a reference. Using it to learn how to build something in PHP is just like using only the dictionary to learn how to write a story. Keep php.net handy for looking up functions, etc that you come across because it will tell you how to use the function and have some code examples for it.

But find a good book, maybe, that takes you from the beginning to intermediate levels in a structured order. Once you have mastered what is in the book, look around for other resources to add to your knowledge and skills.

Jumping around from tutorial to tutorial, as you have found, will only confuse you because different developers have different ways of dealing with things and they might, as I have said before, not be using good practices in what they are teaching and what’s worse, there may even be errors in what they are showing.

Problem is mate I been googling and youtubing for 15 mnths now and no text tut be it a book or ebook or online tut or video tut teach php 7 from top to bottom or atleast teach enough so you can call yourself an intermediate programmer.
tutorialspoint.com, phptherightway.com etc. assume you already know previous version of php. They do not gear a tut towards someone who doesn’t know php. lynda.com udemy etc. will concentrate on a subject like build this or that but not teach the whole language! I yet to find one that teaches difference between procedural and oop. Nay! Explain atleast the difference between the 2.
Every tut online just start teaching not even bothering to mention if it is oop or procedural. That is why my codes contain both because I wasn’t even aware which the tuts were teaching.
I tell you what. Try atleast half hr of searching online for anything that teaches php 7 the OOP way with PDO or MySqli. I can guarantee you you won’t find anything because if you do then I wouldve found it by now and be on my way to learning rather than complain in forums. I only complain when googling is a failure (not due to my fault). LACK OF PROPER PHP 7 OOP PDO TUTORIAL online & offline I’m afraid and silly course sellers can’t see a market here. Blind they are!

Yeah, no. This is NEVER going to happen. It takes time to be even intermediate. If you want to be intermediate within a couple of hours, that’s not going to be even possible.

You sure about that? Because I would like to settle on a bet. I bet you, that it’s easy to find results, it’s just that you are impatient to read through the manuals.

Here, found both examples for PDO and mysqli_*.

http://php.net/manual/en/mysqli.prepare.php

http://php.net/manual/en/pdo.prepared-statements.php


mysqli_* has both OOP and Procedural while PDO only runs on OOP. So you’re looking in the wrong direction.

Don’t look for tutorials on JUST PHP 7 because that’s where you getting stuck. I keep saying this and you keep “classifying” everything you want as PHP 7. PHP 7 IS NOT a NEW language so STOP classifying it as PHP 7. If you have a grasp of understanding general PHP, you WON’T need PHP 7. PHP 7 has new features that ARE NOT even for intermediate. If you don’t understand the basics of general PHP, you WON’T even understand the new features that are introduced in PHP 7.


OOP = Object-oriented Programming. This programming style relates to objects, methods, and classes. If you don’t even understand Procedural programming, you obviously won’t understand OOP.

Procedural is a simple programming style for beginners. Simply put, it’s your basic functions.


Here are some examples of OOP and Procedural codes.

Procedural

// The Bar() function
function Bar($var) {

    // All we do in this example is pass a variable ($var) into the function
    // And then return the same exact value as an output.
    return $var;

}

// Print and use the Bar() function
print(Bar('This is just a string<br />This is also Procedural'));


OOP

// The Foo class
class Foo {

    // Set the variable ($var) to NULL in case the variable does not get called for.
    // Generally, you would do this if you are passing dynamic arguments.
    // This will avoid the error - "Undefined index"
    public $var = NULL;

    // Create a public function called Bar() and pass the variable ($var) through it.
    public function Bar($var) {

        // All we do in this example is pass a variable ($var) into the function
        // And then return the same exact value as an output.
        return $var;

    }

}

// Initiate a new access to the Foo() class
$foo = new Foo();

// Print and call the Bar() function and pass the random string through it
// In order to call a function within a class in OOP
// We first use the variable that we append to the newly initiated class.
// Then, we can call the function we want by using the -> operator
// Lastly, we can than pass our value through that function.
print($foo->Bar('This is just a string<br />This is also OOP'));


Both examples output the same lines

This is just a string

But then output a different line after that to demonstrate which snippet we are using.

So basically, the first example is a Procedural way of calling a function while the second example shows the OOP way of calling a function.

If you can barely get a grasp of just the first bits of the Procedural function, then there is NO way in heaven that you are going to understand any OOP styles in PHP 7 because PHP 7 (as you keep referring to), allow the use of both styles and have since the beginning of PHP 5.

1 Like

spaceshiptrooper,

Thanks for the input.
What I meant was I am still to be showed a book or ebook or online tutorial or online course or video tutorial or course (apart from php.net) that teaches php 7, oop and mysqli and/or pdo.
I know tonnes of sites exist that teach php 5, oop and pdo but then I’d learn a few things deprecated and then would have to search for another site that teaches “what is new in php 7” and then learn what has been deprecated and unlearn them. Waste of time. Therefore, even though php 5 and 7 are same language with same syntax, was hoping for a tut that only taught the stuffs that are still existing in php 7 and were touching both on procedural and oop but oop most and were touching on mysqli and pdo but pdo most. That’s all. Not much to ask. Tut sites that were out before php 7 would teach php 5 deprecated stuff. Frankly, I can’t keep track of what has been deprecated and would forget the deprecated list.
Got my eyes fixed on the following but it ain’t for beginners and so might aswell learn from it when I’ve finished learning from php.net:
https://phpdelusions.net/pdo

And, like I said, php.net is more of a reference book for intermediate and advanced guys like you and not really suitable for beginners who do not know php. If it was, then third party tutorial sites and courses won’t exist who tailor their tuts for complete beginners like me.

Thanks for the procedural and oop demo though. Yeah, you are right, I don’t have experience with procedural or oop styles because these tuts sites, not that many really show examples like you did.
All I understood the difference beteen the 2 is that on procedural you write the code step by step and the interpreter translates the code to machine code line after line while in oop you write blocks of code (custom functions or whatever) and then reference it from the main script flow to those blocks of codes (calling them). A bit like you reference to headers and footers in html file so you don’t have to write the same code on every page. But I guess my understanding the difference between the 2 was flawed from the beginning. Right ?
Anyway, I’m sticking to php.net for the time being. From your experience they teach procedural to beginners. Right ? But from which point onwards they start teaching oop, do you reckon ? I haven’t visited the site lately as I got put-off from it. Didn’t want to return to it incase I get totally put-off from php altogether. But I guess I have to take a deep breath and make my mind stronger (make a strong will) and return to it. Shall I tell you what put me off from the site ? Actually, there is nothing wrong with the tut itself apart from being too brief. Because it is too brief, I started looking at other contributor’s codes who explain with their code examples what problems they encountered (trial and error, what worked and what not and how to tackle the problems, what are bad practices and what not). It is going through these codes from contributors which the official site added as their tut made my head spin and put me off as the contributors’ codes definitely weren’t suitable for beginners. Felt like being thrown in the deep end of the swimming pool. You know what I mean.
Anyway, recently been thinking, I might aswell forget going through each and every codes from contributors and just finish reading the code examples of the official site and practice the basic codes so I can memorize them as much as I can and then on the 2nd round look into the codes of the contributors. Now, you might have a question, why did I go through the codes of the contributors in the first-place ? Well, I wanted to see what problems they faced so if I face them then I can use their coding practices to get over any stumbling block. Else, I’d be stuck in the middle of the ocean in an isolated island and then quit php altogether.

Anyway, I wish myself luck.
And thanks for reading upto here and for willing and trying to help!

PS - It was my birthday yesterday. I’ll take your code examples as my birthday gift. Lol!
Feeling a bit grumpy because I really wanted to get over the errors I’m facing and finish my social network on my birthday as my birthday gift. Been working on it for 42 days now.
Wanted to complete making an SN that copies the concept of the Fan Browser (.exe). Build a web or SN (Social Network) version of the Fan Browser. (Check youtube for Fan Browser. It’s a browser that publicises to the public domain what you are browsing in your public session so the public can follow you online from website to website and webpage to webpage. You earn when your trailers/followers click links trailing you. Unlimited people from the public can follow you this instant and so your income is potentially unlimited. Marketers mostly would be dogging your fingersteps to learn what you are searching for and in the process their trailing would earn you ppc.). But because I’m a complete newbie, I’m taking shortcuts and coming across obstacles.

Any decent, recent tutorial, even if based on php5 should not be using deprecated code, as in things that were deprecated in 5 and removed from 7. Of course the pit-fall for beginners is knowing the difference between a decent tutorial and a poor (out-dated) one. If you are keen to learn php and oop, it would not hurt to use a tutorial even if it is not specifically for v7, so long as it is reasonably up-to-date and from a reputable source.
If you do happen to inadvertently use deprecated or obsolete code, use strict error reporting and it will soon let you know about it so it can be fixed. If this happens to any extent using a tutorial, you know you have the wrong one.

But if I want to be brutally frank with you, I think you really need to take a step back from php for now and first of all learn HTML5 and CSS3 before even considering any PHP. Going by the code you posted in your other topic the html and styling methods you are using are somewhere in the dark ages as well as invalid and non-semantic. You must learn to walk before you can run. You need to at least learn html first before embarking on any ambitious project such as this.

1 Like

Ha! Ha! I’m back on your trail again!
Like I said on the other thread, the html was copied from a youtube tut. Was not paying much attention to html as was using the html as a rough skeleton. Once the php parts are fixed, i’ll deal ith the html and css later. I’m more excited to see how php would behave towards the features I want to build. So, php priority.

You now understand why I was fussing about php 5 tuts. I don’t think you will find a php 5 updated tut. If any do get updated by throwing aay the deprecated stuff, they’d be classified as php 7 tut and not 5. (After-all, 5 & 7 are same lang with same syntax).
Frankly, the php 5 tuts won’t throw away the deprecated stuffs because they would be needed when people get stuck on coding when updating codes on servers run on php 5 interpreter. Makes sense not to ditch the deprecated and it makes sense why I fear the new students would learn the deprecated if they stick to php 5 tuts.

Take care!

I see that now. Using things like <center> tags does make me think it is not an up-to-date tutorial, maybe they were purely a back-end dev and know little of the front end.
But from the php perspective, the non-use prepared statements and the mingling of html and php, it did not look good to me.

1 Like

Do not get offended when I say I do not underrstand non-use prepared statements. Remember, I only read upto VARIABLE chapter on php.net.
I’ve downloaded about a 100 php tut vids from youtube and the topics are:

build your own login-reg member site
build your own web crawler
build your own google like searchengine
how to delete multiple rows in mysql
how to create tbl in mysql
how to insert into mysql
how to build reports in php
how to multiple update into mysql
how to web scrape with curl
build your own shout box
build your own im
build your own facebook like chat
build your own url shortener
how to accept paypal payment with php
etc.

Only been viewing vids on how to build member login-reg site
Now gonna move-on to building the search system, then the chat, shout box & im system.

I know if you learn the basics of inserting, updating, deleting data onto/fro mysql then you can build most things like friend request, im, chat, etc. (every form of communication system between users). That is why I put my “orthodox learning of the php lang” to a temp halt so can concentrate on those aspects of php & mysql to build my SN that deal with user inputs/outputs to mysql.
You know what I mean. It is gonna take probably 6 mnths to learn php enough to consider myself an intermediate. Why wait that long and why only start on my SN after completing the lang, where I’d have to learn a lot of irrelevant functions to my SN and so took a shortcut to youtube to find and learn the basic codes that deal with inputting & outputting data to/fro mysql. And ofcourse, found different programmers teaching slightly differently and left me confused. But, I’m learning from my mistakes and their pointing outs from guys like you. :slight_smile:

Back in 1998, I learnt the center tag like this and so should I use it ?

<p align="center"></align>

I guess this works too:

<p align="center"></p>

Both of those look wrong to me.

The first has an opening p tag paired with a closing align tag.
The second has an obsolete attribute

Note: The align attribute on <p> tags is obsolete and should no longer be used.

Try C-Style-S instead, you’ll be glad you did

I probably could have taken more care in writing that, I think what I meant was “non-use of prepared statements”.
As in they are using PDO, but not using prepared statements, which you should always do if there is any user input in the query. You already have a link to the PDO tutorial by @colshrapnel which is quite in-depth.

OK, this is going off-topic into the realms of HTML & CSS, I can split to a new topic there if it goes too far.
Things have moved on a bit since 1998. Now html is used purely for content. Styling and layout is all done by CSS, so what are known as “presentational” elements and attributes, such as <center> and align have mostly been dropped from the spec.
For example, if you wanted <p>s to be centred, you would have some css like: p { text-align: center; }
More likely you would not want every <p> to be centred, so you would use a class for that. So the html would be:-

<p class="centre">Some text in the middle.</p>

and the css would be:-

.centre { text-align: center; }

Now that same class could be used on any element, not just <p>s.

This is of course a whole other subject to learn, which as I mentioned before, probably should come before learning php.

A post was merged into an existing topic: PHP & MYSQL Novice to Ninja Code Question

Allow me to once again suggest starting with a well known framework such as Laravel (accompanied by the Laracast videos).

In your particular case I get the impression that you are perhaps floundering a bit primary because there are so many resources to chose from: 96.7% of which are either outdated or crap.

A framework, by it’s very nature, is opinionated. Frameworks try to steer you down a particular in your quest to produce a quality application. By eliminating many choices they allow you to focus on what is important. Your application logic.

Well known frameworks also have a huge support network. Questions asked based on a particular framework version will often be addressed by a large number of developers using the exact same software.

And here is the big finale. Just because you start with a particular framework does not mean you are locked into that framework for ever and ever. Once you have a couple of working apps under your belt then you should know enough to be able to critically examine the framework’s recommended practices and start to understand and explore alternative approaches.

P.S. I recommend Laravel mainly because of the Laracast videos. If you learn better by reading then go with Symfony. Can’t go wrong with either one.

Adding onto the HTML & CSS validations.

You can upload your HTML & CSS files to the official w3 website to validate if your files are using standard HTML & CSS or if it is not.

https://validator.w3.org/ ← That’s for HTML

https://jigsaw.w3.org/css-validator/ ← That’s for CSS


NOTE


These 2 websites ARE the official w3 website. This website is DIFFERENT from the infamous w3school. w3.org and w3school.com ARE different individuals and have NO affiliations with each other. The official w3 website is w3.org while w3school.com IS a fan based website. REMEMBER THAT!!!

Do not worry. I know a little css. I just wasn’t aware html center tag and stuffs are out of html 5. You and a few others brought it to my attention. I only copied what the youtube tut showed.
Thanks for the css sample, though. You’re jogging my memory.
In the meanwhile I am leaving the html center tag as I really need to get the php fixed first and not bothered about html or css for now. Once that is out of the way, then I will deal with html & css and so just ignore the invalid html from my threads for the time being.

Thanks!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.