Tag: php

The 80/20 rule of web development

I once did this YouTube video. It was called the “Exact PHP Skills You Need to Learn to Get Paid to Code.” The idea was there’s all these things you think you need to learn or you get told by some ranting know-it-all that you need to learn… But, in reality… You only use a small fraction of those skills on a regular basis. So, I made a list of the things you’ll use most often as a PHP developer. The things that make up 90% of the coding I do. Variables, arrays, loops… That sort of thing. It’s been

Read More »

Object-oriented programming in PHP

This just can get confusing as hell, sometimes. I kinda just shake my head at the “Intro to OOP” tutorials that spend the whole time talking about “polymorphism” and “encapsulation”. It’s no wonder a lot of developers hold out learning OOP. Anyway, the most important… Most fundamental… Object-oriented programming principle is much, much simpler. And, I think a big “aha” for developers. Of course, that’s probably just my naive “don’t confused the hell out of people on day 1” opinion, but who knows. Anyway, if you’ve been wanting to tackle OOP in PHP, but been afraid it’s complicated as hell…

Read More »

Why so many programmers say PHP stinks

I was perusing Quora today and came across this question: “Why do so many programmers say PHP is a bad language?” Of course, that ruffled ol’ Johnny’s jimmies, so I clicked to so see some of the answers and this one made me laugh: “They’re the same people that want to ban bread knives from being sold based on the premise that they’re murder weapons. “As the saying goes – ‘PHP is so easy to learn that any idiot can use it. Far too many do.’ You can write terrible, horrible code in every programming language out there. In hard to

Read More »

What they DON’T tell you about PHP

I got this Facebook comment from Jeremy: But, you won’t hear that from any PHP hater. And, I know… I’m beating this horse to a bloody pulp… But, it’s like I said yesterday: And, people asking if it’s true. So, bust out the baseball bat… I’mma keep hammering away at this. In any case, you can sit around worrying about if “PHP is dying” or whatever nonsense they dream up next… or you can make like Jeremy… And, get to work. There absolutely ARE plenty of tech jobs… And, freelance projects for PHP developers. Just gotta get out there and get

Read More »

PHP usage statistics are bunk

Blah, blah… traffic… something, something. I guess that’s the strategy. When usage statistics don’t show that PHP “is like totally dying and stuff”, then we jump to whatever other statistic that fits our narrative. Anyway, here’s the rebuttal:

Read More »

PHP isn’t used by REAL websites

I’ve been getting these comments more and more lately: “…let’s just consider that 80% figure, in those stats all websites count the same, so 1 WordPress blog that has not updated in 10 years and gets 10 hits a week counts the same as Youtube getting billions of hits, you see the problem with that, in reality when measured by what counts (usage/traffic) most of the web is not powered by PHP” This seems to be the new thing among PHP haters. They really want to be able to say PHP is dead. But, then there’s those pesky usage statistics

Read More »

Fake PHP jobs

So, from yesterday… There’s obviously lots of PHP jobs posted out there. But, Leon asked this in response to that video: “How many companies lie about their intentions to hire, to create a false shortage, to argue for more (cheaper) foreign workers?” I’ll keep it real. My gut reaction is: “Who gives a f!@#?” It’s not ALL of them. I know that. And the only way you’ll really know is to apply. It just feels like an excuse to me. And, that gets my inner grumpy old man outta his chair. Buuuuuuut. Let me be civil. I looked it up.

Read More »

PHP jobs you can apply for right now

I get a lot of PHP haters who love to drone on about there being no PHP work out there. Or, well-meaning PHP developers who are struggling a bit to find PHP work. Well, this massive list of PHP jobs should cure both: And, do let me know once you get hired. Gives me ammo for the PHP haters. 🙂 Later, John

Read More »

Why is PHP still being used to create websites?

This was pretty epic. A real drop-the-mic-er. It was this answer on Quora I saw the other day from Vakrokh. The question was: “Why is PHP still being used to create new websites? Why aren’t all new sites using more modern frameworks such as Django or Rails.” I love how these guys just throw “modern” in there. As if “modern” automatically equals “better”. Anyway, here was Vahrokh’s answer: “PHP is not still being used. ‘Still’ is a word suitable to 2012 PHP, when it has been under an heavy rework and to end users / programmers it looked like it was

Read More »

All the web development you’ve learned will be obsolete in a year

You ever watch the movie, Twister? There’s a scene at the end where they’re trapped in this small shed, tied to some pipes as a Tornado rolls right over them, tearing the shed to pieces. Debris everywhere. Legs flying in the air. Complete chaos. But, there’s a moment where, Helen Hunt, one of the main characters, can see all the way to the top of the tornado. And, it’s nice calm, blue sky. Almost peaceful. That’s sometimes how I feel. As I’ve talked about… all the chaos and change coming so rapidly in our industry. There’s so much to learn

Read More »

Why Are Developers Still Learning PHP?

Better question: “Why are people still asking why are people still learning PHP?” Sigh. This Quoran gave one of the better answers I’ve seen. Plus how you’ll know if #PHP does ever legit die. You can listen to the discussion here: https://www.johnmorrisshow.com/332/ #webdev

Read More »

Output the last row inserted in MySQLi

MySQLi makes grabbing the last inserted row easy. After running your insert query, you can do this: $id = $mysqli->insert_id; Then, you can query for that row like this: $result = $mysqli->query(“SELECT * FROM table_name WHERE ID = {$id}”); And, fetch the result as an object: $user = $result->fetch_object(); From there it’s a simple echo to output it to your page: echo $user->user_name; (Although, you’ll want to use htmlspecialchars or htmlentities to escape the output and prevent XSS attacks. But, we’ll save that for another day.) Simple. Anyway, in the newly released Module 3 of PHP 101, I show you

Read More »

Connecting to MySQL with PDO

With MySQLi, it looks like this: $mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name); But, PDO is a bit different because it can interact 12 different types of databases: Oracle, PostgreSQL, SQLite, MySQL, Cubrid and several others. So, when using it you have to specify which driver you want to use. Like this: $conn = new PDO(“mysql:host={$db_host};dbname={$db_name}”, $db_user, $db_pass); Notice the “mysql:host=” bit. For different drivers, you just change out the “mysql” part. So, PostgreSQL would be: $conn = new PDO(“pgsql:host={$db_host};dbname={$db_name}”, $db_user, $db_pass); For Oracle, it’d be: $conn = new PDO(“oci:host={$db_host};dbname={$db_name}”, $db_user, $db_pass); And, so on. Nice thing is… The code

Read More »

Simple input filtering in PHP

Here’s one I don’t see talked about much: $name = filter_input(INPUT_POST, ‘name’, FILTER_SANITIZE_STRING); What this does is grab the “name” element from your POST array and run it through the the filter: FILTER_SANITIZE_STRING… which removes all HTML tags from the string (since we know a person’s name doesn’t have HTML in it). It’s a really simple way of quickly filtering your data. Here’s another: if ( ! $email = filter_input( INPUT_POST, ’email’, FILTER_VALIDATE_EMAIL ) ) { die(‘Invalid email’); } This one validates the submitted email address. And, returns false if it’s invalid. Again, a very simple way of quickly validating

Read More »

Why I don’t use PHP frameworks

“They all suck!” That’s straight from the horse’s mouth. Rasmus Lerdorf, the creator of PHP. He went on to say: “While they all suck. Everyone needs a framework. What everyone doesn’t need is a general purpose framework. Nobody has a general problem. Everyone has a very specific problem they’re trying to solve. And a general purpose framework, while it can solve it, it usually solves it in a way that you get so many other things that you don’t need… that ends up being done on every request.” He goes onto recommend using “targeted frameworks” for targeted problems: “Usually, I

Read More »

Is PHP Dead?

Critics have been saying PHP was dead for years now. But, here it is… still tickin’ away… picking up market share and powering the web. Matter of fact, one of the harshest criticisms I’ve seen on PHP… comes from a WordPress blog. Ya know, built on PHP. But, with the rise of frameworks like NodeJS and the resurgence of Python… Has PHP seen its last days? Should you invest time learning it? Or, will it be obsolete in 5 years? I tackle that in today’s podcast. Give it a listen [smart_track_player url=”https://soundcloud.com/johnmorrisonline/jms129-is-php-dead” social=”true” social_twitter=”true” social_facebook=”true” social_gplus=”true” ] Plus, I snuck

Read More »

PHP cURL Tutorial and Example

A simple PHP cURL tutorial and example. Learn how to use curl_init, curl_setopt, and curl_execute. Also learn how to POST data to a remote URL using cURL. Ready to learn even more PHP? Take my free Beginner’s Guide to PHP video series at https://johnmorrisonline.com/learnphp Get this source code along with 1000s of other lines of code (including for a CMS, Social Network and more) as a supporting listener of the show at https://johnmorrisonline.com/patreon P.S. If you liked the show, give it a like and share with the communities and people you think will benefit. And, you can always find all my

Read More »

PHP 7’s Null Coalescing Operator: How and Why You Should Use It

PHP 7’s null coalescing operator is handy shortcut along the lines of the ternary operator. Here’s what it is, how to use it and why: Ready to learn even more PHP? Take my free Beginner’s Guide to PHP video series at https://johnmorrisonline.com/learnphp Get this source code along with 1000s of other lines of code (including for a CMS, Social Network and more) as a supporting listener of the show at https://johnmorrisonline.com/patreon P.S. If you liked the show, give it a like and share with the communities and people you think will benefit. And, you can always find all my tutorials, source

Read More »

The Thing About PHP 7’s Spaceship Operator

Subscribe So You Never Miss An Episode [saf] May the force be with you… 😉 Unless you’ve been under a rock (which is totally cool if so) you know PHP 7 has been out for a bit now. I finally took some time the other day to fire it up on one of my dev servers and see what all the fuss is about. Online, I’d kept hearing about this “spaceship” operator. This thing’s kind of cool actually. Let me show you. So, here’s a common bit of code you might see pre-PHP7: This is a sorting routine. usort() lets

Read More »

Should You Learn PHP or Python? What About Django?

[smart_track_player url=”https://soundcloud.com/johnmorrisonline/jms106-should-you-learn-php-or-python-or-django” social=”true” social_twitter=”true” social_facebook=”true” social_gplus=”true” ] Subscribe to the Podcast [saf] Those of you who’ve been around a bit know I used to be an Al Bundy. Yes… I will come clean. I used to sell shoes. And, by the way, I was pretty damn good. I remember I once sold $8100 worth of shoes in one week… which was crazy for the chain I worked at. Double what was considered a good week. Anyway, of course, in the store we had all kinds of shoes. And, most of use who worked there were in love with the brand:

Read More »

The EXACT PHP Skills You Need to Learn to Get Paid to Code

[smart_track_player url=”https://soundcloud.com/johnmorrisonline/jms104-the-exact-php-skills-you-need-to-learn-to-get-paid-to-code” social=”true” social_twitter=”true” social_facebook=”true” social_gplus=”true” ] Subscribe to the Podcast [saf] I chuckled a bit when I read it. You might have seen me ask this question. And I do it because I really want to know where you’re at because that’s the only way I feel I can really help you. So, I’d asked… “What if I told you I could teach you how to master PHP to the point you can start getting work building PHP applications… in just the next few months?” Now… getting off-subject a bit… that’s an interesting thing to ponder… What if? You

Read More »

A Fry Cook’s Secret to Changing Your Life With PHP

[smart_track_player url=”https://soundcloud.com/johnmorrisonline/jms103-a-fry-cooks-secret-to-changing-your-life-with-php” social=”true” social_twitter=”true” social_facebook=”true” social_gplus=”true” ] Subscribe to the Podcast [saf] Not that long I was a fry cook at a local pizza joint. I clocked into work each day, in my ill-fitting uniform, wearing my funny hat and I’d spend the next 4-5 hours wallowing in grease, yes ma’am-ing and no ma’am-ing my way through the day. I was miserable. But, the thing that really ate at me was deep down I believed I was capable of so much more. I KNEW I was. And, I just couldn’t figure out how I’d let my life get to the

Read More »

How to Get the First Value In An Array Using PHP When You Don’t Know the Keys

Arrays are like that crazy uncle who gets a little too drunk at Christmas and starts telling inappropriate jokes at the dinner table. You love ’em… but you hate ’em. You can efficiently store and grab tera-tons of data with them… but when you just want to get the value of the 2nd element in the 3rd dimension of one… you feel like you gotta break out the code-jitsu to get at it. Have no fear! Captain JMO is here! I just cranked out a new video for you showing you several different ways to get at different keys and

Read More »

How to Create a Contact Form Using PHP

When you create a contact form in PHP, there’s a couple key parts you need to make sure are in place so the person actually using the form doesn’t want to suddenly get into knife-throwing (at your head) afterward. You need validation that make sense and is easy to understand. I prefer the kind that shows up all at the top of the form, because when you have a long form and missed one checkbox and have to go hunting through the form like you’re looking for a lost sock… knife-throwing becomes a viable option. Next, you need to make

Read More »

How to Create a Zebra Striped Table With Odd Even Row Colors Using PHP

In this PHP tutorial, you’ll learn how to create a zebra striped table by adding odd and even classes in a loop using PHP. Watch the tutorial below: Links mentioned in the video: Link to the Complete Web Developer Course with discount. My web developer resources page with more code snippets. Here’s the code I used in the video: Get the source code for this video as a supporting listener of The John Morris Show on Patreon If you get value from this code snippet, please consider sharing it with another developer or group who could benefit from it.

Read More »

Who else wants to build a thriving freelance business?

I’ve helped 39,413 other freelancers start and grow thriving freelance businesses. Are you next? Subscribe to my Freelance Secrets newsletter and I’ll show you how.

Success Stories

Ready to add your name here?

Tim Covello

Tim Covello

75 SEO and website clients now. My income went from sub zero to over 6K just last month. Tracking 10K for next month. Seriously, you changed my life.

Michael Phoenix

Michael Phoenix

By the way, just hit 95K for the year. I can’t thank you enough for everything you’ve taught me. You’ve changed my life. Thank you!

Stephanie Korski

Stephanie Korski

I started this 3 days ago, following John’s suggestions, and I gained the Upwork Rising Talent badge in less than 2 days. I have a call with my first potential client tomorrow. Thanks, John!

Jithin Veedu

Jithin Veedu

John is the man! I followed his steps and I am flooded with interviews in a week. I got into two Talent clouds. The very next day, I got an invitation from the talent specialists from Upwork and a lot more. I wanna shout out, he is the best in this. Thanks John for helping me out!

Divyendra Singh Jadoun

Divyendra Singh Jadoun

After viewing John’s course, I made an Upwork account and it got approved the same day. Amazingly, I got my first job the very same day, I couldn’t believe it, I thought maybe I got it by coincidence. Anyways I completed the job and received my first earnings. Then, after two days, I got another job and within a week I got 3 jobs and completed them successfully. All the things he says seem to be minute but have a very great impact on your freelancing career.

Sarah Mui

Sarah Mui

I’ve been in an existential crisis for the last week about what the heck I’m doing as a business owner. Even though I’ve been a business for about a year, I’m constantly trying to think of how to prune and refine services. This was very personable and enjoyable to watch. Usually, business courses like this are dry and hard to get through…. repeating the same things over and over again. This was a breath of fresh air. THANK YOU.

Waqas Abdul Majeed

Waqas Abdul Majeed

I’ve definitely learnt so much in 2.5 hours than I’d learn watching different videos online on Youtube and reading tons of articles on the web. John has a natural way of teaching, where he is passionately diving in the topics and he makes it very easy to grasp — someone who wants you to really start running your business well by learning about the right tools and implement them in your online business. I will definitely share with many of the people I know who have been struggling for so long, I did find my answers and I’m sure will do too.

Scott Plude

Scott Plude

I have been following John Morris for several years now. His instruction ranges from beginner to advanced, to CEO-level guidance. I have referred friends and clients to John, and have encouraged my own daughter to pay attention to what he says. All of his teachings create wealth for me (and happiness for my clients!) I can’t speak highly enough about John, his name is well known in my home.

Sukh Plaha

John is a fantastic and patient tutor, who is not just able to share knowledge and communicate it very effectively – but able to support one in applying it. However, I believe that John has a very rare ability to go further than just imparting knowledge and showing one how to apply it. He is able to innately provoke one’s curiosity when explaining and demonstrating concepts, to the extent that one can explore and unravel their own learning journey. Thanks very much John!

Mohamed Misrab

Misrab Mohamed

John has been the most important person in my freelance career ever since I started. Without him, I would have taken 10 or 20 years more to reach the position I am at now (Level 2 seller on Fiverr and Top Rated on Upwork).

Who else wants to build a thriving freelance business?

I’ve helped 39,413 other freelancers start and grow thriving freelance businesses. Are you next? Subscribe to my Freelance Secrets newsletter and I’ll show you how.