How to learn next level in PHP

OOP is not designed for hardware efficiency. It is designed for programmer efficiency. For more than 40 years they have been saying that people time is much more expensive than machine time yet programmers spend an excessive amount of time making the computer more efficient. We should make our programs efficient for the hardware but there is much value in making the code efficient for us.

1 Like

Your communication skills are very good. The way you write this line was also self-explaining why the keyword ā€œImplementā€ is used.

1 Like

As far as learning PHP is concerned then considering there is well over 1,000 functions then everyone is still learning especially since revisions and updates nearly occur on a daily basis!

Do you have your own server? If so try installing a free domain from Freenom.com,
codeispoetry.tk is available! and also .ml, .ga, .cf and .gq TLDs (Top Level Domains).

Instead of struggling with content, pick a hobby/topic that you are familiar with; cars. bikes, boats, records, football, flowers, cooking, etc. If you have your own server then create a web-site otherwise create a personal local application. Start with a simple HTML static site, introduce PHP, MySql, eMail, Classes, OOP, etc The personal site can be an ongoing and ideal for testing new features.

I think this is far better than learning topics from a course which may never be used.

Edit:

I forgot to include the PHP Classes stuff

I like the idea of PHP Classes because it containerises functions/methods/ instead of having them splattered all over the application. Adding additional functions/methods are very easy and ideal for testing new versions of a function.

The free PHP Online Manual is excellent for syntax and also has an abundance of examples.

Please do not comment until the demo has been downloaded, tried and tested!

Here is a demo of using a PHP Class, nice and simple !

file - index-001.php

<?php declare(strict_types=1);
# should be set in php.ini
  error_reporting(-1);
  ini_set('display_errors', 'true');

$title = 'title goes here';
 
 require 'Class_images.php'; 
 $obj = new Class_images;

?><!DOCTYPE html>
<html>
<head>
  <title> <?= $title ?> </title>
</head>
<body>
  <h1> <?= $title ?> </h1>
  <h2> <?= $obj->test_001() ?> </h2>
  <h2> <?= $obj->test_002('asdf.jpg', 180, 180) ?> </h2>
  <h2> <?= $obj->test_003() ?> </h2>
</body>
</html>

file - Class_images.php

<?php declare(strict_types=1);

# ============================================================
Class Class_images
{

# ============================================================
PUBLIC function test_001()
{
 echo __method__ ;
}#endmethod


# ============================================================
PUBLIC function test_002
(
  string $src,
  int $wid,
  int $hgt,
): string
{
  echo __method__ ;

  return '<br>$src ==> ' .$src .'<br>';
}#endmethod

# ============================================================
PUBLIC function test_003
(
  string $src ='DEFAULT-IMAGE.jpg',
  int $wid    = 180,
  int $hgt    = 180 
): string
{
  echo __method__ ;

  return '<br>$src ==> ' .$src .'<br>';
}#endmethod


}#endclass  
1 Like

I actually came to Sitepoint only knowing procedural. I think at one point, I asked someone (it might have been @SamA74) if they could show an example of OOP. They did and at the time, I didnā€™t understand it much. It took me a while and reading articles on certain OOP aspects didnā€™t help either because mixing terms and throwing in ones that Iā€™ve never heard of just confused me even more. But then one day, it clicked and I started to get it. It connected like a puzzle if you will. Then I went to college and I started learning C#. Then all I did was apply the OOP I learned in PHP to C#. Took 4 semesters of C# then took C++ and then onto Java.

Basically what Iā€™m trying to get at is that OOP isnā€™t just exclusive to PHP. You can apply this with majority of programming languages and youā€™ll do fine. But everyone has a learning curve so it may take you more time to understand than most. I know it did for me.

2 Likes

True enlightenment happens suddenly.

2 Likes

Thank you. Not everyone appreciates concise answers. I have benefited from seeing many other relevant discussions elsewhere.

Early versions of OOP existed half a century ago. And a very simple explanation of the difference between C and C++ is that C++ is C with OOP added.

2 Likes

So true. I struggled for years trying to grasp OOP and then literally in a single day out of the blue the light came on and just like that, I got it.

3 Likes

I think part of what puts me off it a little is that my first experience of OOP is developing for Symbian mobile phones. OOP is required, but itā€™s not straightforward at all. I bought a book that I hoped would help me, and while it was very helpful, it didnā€™t translate all that well to the Symbian c++ language. I did get it working, after a lot of messing around, but a lack of on-device debugging (for what I was doing) made it very time-consuming.

2 Likes

Hello everyone, Thanks for your insight. Although the discussion didnā€™t provide any frequently traveled path that can be traversed to connect the next dot in learning OOP PHP because everyoneā€™s paths are different.

The discussion was very meditative as everyoneā€™s shared their experience that we all started from some point and faced similar challenges, but with mindfulness, fortitude and consistency, we all get through the toll gate of anything that requires a certain threshold and patience.

My advice would be to think of a simple project, say a database application or registration and then find out how to do it. Learning any language for the sake of learning is very difficult but to apply it to a need is much simpler.

Again my path, I first installed XAMPP so I had a local server, php and mysql. Then I started to include php in web pages, then added a database, then email, then registration.

Itā€™s much simpler and much more fun if you have a target.

1 Like

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