MyBB Community Forums

Full Version: Best way to learn PHP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So I want to hear your opinions about best way to learn php?

I know basics, I've done some simple things with it like calculators, tic tac toe game etc. But I want some examples, some ideas what I can do and so. If I'm stuck somewhere I can just google it, there is solution for everything.

Just have you some ideas and so?
Also, I mostly programmed line by line, I'm interested now for some object oriented programing, where I can find some best examples for that?

Thanks Big Grin
One of the hard things about learning to code is that you have to play all of the possible roles of software development at once. At a time when you are doing good to translate your ideas into problem-solving code, you are forced to:
  • Come up with ideas of things to create
  • Contrive some basic idea of how to make it happen programmatically
  • Contrive some sort of design for any interface needed
  • Create any graphics needed (or select them from Creative Commons, etc.)
  • Perform the actual coding
  • test
  • fix bugs
  • test, etc.
  • Write documentation
  • Handle "marketing" (in other words letting people know that what you have created exists)

You are smart to ask the public for ideas because inspiration is the one component that you can't just hammer past.

I would suggest looking through MyBB's repos and find issues that you think you can solve. Or really, any project that is using languages you are learning. Ask questions about how unassigned issues should be handled, get input and subit PRs— be patient when contributors ask for change and use it as a learning tool.

One of the mistakes I made early on was trying to build my own software from scratch when there are tons of third-party frameworks that can make things happen faster AND help you to learn how modern OOP is done.

Just my two cents. Oh and this
Thanks Smile

I wanna try build something from scratch, but not a software. Just some simple programs as I'm afraid to work something at MyBB directly yet, because I don't know it too much so I can see what will happen if I change something. I mean, I know what will be changed, but I don't know what bugs can occour at rest of site...

I know html/css and basics of JS, I know MySQL. Basics of PHP...

What framework would you suggest me and how it works?

And, I worked at PLC programming for about a 2 years, sometimes some complex things for factories and I hadn't bugs, not even like if drunk worker press button few times or if some sensor stop working and so hahah, also I had some MCU programming so I consider myself really good at programming logic and I always check all possible solutions so it takes me quite some time but I love it.

At MyBB I don't know rest of code so according to that I cannot check every solution and I'm afraid to make some plugin or something because of that.
I learned by looking through the MyBB source files and then wanting to create new features. Recently I created a website for Pokemon Go in my local area that uses a couple different APIs from Google, one from Facebook, and another for weather. That website is for planning raids and meetups. My next project that I am working on is creating a new framework from scratch. I found Laravel to be confusing to even setup.
(2018-01-23, 12:21 PM)dragonexpert Wrote: [ -> ]I learned by looking through the MyBB source files and then wanting to create new features.  Recently I created a website for Pokemon Go in my local area that uses a couple different APIs from Google, one from Facebook, and another for weather.  That website is for planning raids and meetups.  My next project that I am working on is creating a new framework from scratch.  I found Laravel to be confusing to even setup.

Yeah, I "tried" that few times but classes are too confusing lol
I will check it again this days maybe
If it's something like MyBB, the trickiest thing there is probably maintainability and security.
Especially security, I can't list the sheer number of ways there are for someone to completely screw you over.

Timing attacks, XSS, SQL Injections, Spectre, CSRF, XML surprises, serialize() being insecure, Apache running bah.php.txt as a PHP file, and the list goes on.
If you have code that looks like this:
->query("SELECT uid FROM users WHERE uid = $uid")
Then it is insecure.

If you use eval, then you are probably insecure.

If you do permission checks on the client, then you are probably insecure.

If you think that randomising a filename makes it impossible to deduce, you are probably insecure.

If your code looks like this:
<title><?php echo "Page Title"; ?></title>
Then, you are probably insecure.

If you use XML, you are probably insecure.

If you think that XSS in one tab doesn't affect others for your site, then Spectre has some surprises for you.

Frameworks are usually good for somewhat protecting you from these things, but even they aren't omnipotent.
Laravel in particular seems to be good to stop you from tripping over yourself too badly. I believe you get a template engine (largely solves XSS), a query builder (solves SQL Injections), has functionality for dealing with CSRF, is probably not that stupid about timing attacks, etc. and so forth.
yeah i also was trying to learn this, thank you
PHP is one of the easiest scripting languages for server side to make a dynamic website. W3school is the best website for beginners to learn. There are topic wise, which is learning very easily. One more thing, I will tell you that only theory is not enough for you. It means you need to have a daily practice on your laptop.
There are lots of video tutorials and I think PHP books are also very good resource.
But practice and coding is the most important thing irrespective of the medium to learn.
(2019-10-10, 12:56 PM)WallBB Wrote: [ -> ][...]
But practice and coding is the most important thing [...]
That's the key - and the truly will to do so!

A cook is not just reading cookbooks. Become a cook by cooking > Become a coder by coding Smile

It makes no sense to begin useless stuff to code just for learnig - this brings less elation. First go through the basics of PHP (basic functions, syntax, ...), then try to find a simple project you wish to start. Take your basics and find solutions for every further step you need to achieve with help of all PHP resources available on the net.
And never forget there are many ways to achieve a goal - there is never one and only way but there are bad ways and ways reflecting the character and identity of a coder.

One more advice. "Trial and Error". Just try. So you can learn how things work. Furthermore you will learn how things do not work what it also essesntial for coding.

[ExiTuS]
Pages: 1 2