The Entrepreneur Forum | Financial Freedom | Starting a Business | Motivation | Money | Success

Welcome to the only entrepreneur forum dedicated to building life-changing wealth.

Build a Fastlane business. Earn real financial freedom. Join free.

Join over 80,000 entrepreneurs who have rejected the paradigm of mediocrity and said "NO!" to underpaid jobs, ascetic frugality, and suffocating savings rituals— learn how to build a Fastlane business that pays both freedom and lifestyle affluence.

Free registration at the forum removes this block.

Web Programming with PHP (guide for non-engineers)

ApeRunner

Very Fast on a Bike
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
326%
May 16, 2014
166
541
43
Cozumel
Are you ready to start programming?
8594455273_23f87d3daf_b.jpg


Many people in this forum want to get started on programming. In this thread, I will teach you how to program in the PHP language. Why PHP? Because is powerful, easy to learn and has the best community (compared to other languages).

I have been programming in PHP for more than ten years now, and it appears I will never stop doing it. It’s just a super useful skill for an entrepreneur. I have various business and websites running and I program for all of them at different levels and circumstances.

I know there are other languages to program for the web: Python, Ruby, C-sharp, etc. But I recommend PHP for entrepreneurs. Why? Because…

PHP is Powerful

Empires have been started/created with PHP. This language has humble beginnings and started more than two decades ago as a “Personal Home Page” pre-processor. But now is a very mature language with a fast runtime (PHP 7) and a full object-oriented model.

These are some of the projects/companies that started with PHP:

· Facebook: One of the most powerful companies in the world.

· WordPress: Its software is said to power 80% of the world’s web pages.

· Magento: The most advanced e-commerce shopping cart. Recently acquired by Adobe for $1.68 Billion (USD).

· XenForo: This forum.

Also used by Slack, Etsy, Wikipedia, Tumblr and lots of sites.

In my 15 years of using PHP I have never encountered a situation where I couldn’t solve it with PHP. Of course, I have to complement it with JavaScript on the front-end, as is commonly done.

PHP is Easy to Learn

This is one of the main advantages for the language. I think the common profile of the PHP coder is that, we, come from non-engineering careers. The learning curve is low compared to other languages such as Python.

If you are an entrepreneur, you don’t have the time to spend years learning a technical skill. Because you’ll be wearing many hats. And you have to be fast delivering results (minimum viable product?).

We entrepreneurs are not specialists but generalists. We have to keep the big picture. With PHP you don’t have to spend all your life in the technical space.

When I got my first job as a coder, I learned to program in PHP in a matter of months. And delivered results for the company that hired me. As years passed I became a better coder. And with PHP you can evolve to more complex coding.


PHP has the Best Coding Community

I have not experienced this at first hand, but my coder friends tell me that the PHP community is more friendly than the communities of other languages. I think is because we PHP coders don’t pretend to be perfect engineers. We just want to get the job done. As a result of this, there is a lot of resources along the internet and the PHP Conferences around the world are thriving and very welcoming.

There are more open source projects in PHP than any other language. A lot of the most successful open source projects are made with PHP:

· E-Commerce: Magento, WooComerce, PrestaShop, OpenCart…

· Content Management: WordPress, Drupal, Joomla, ProcessWire (awesome framework)…

· General purpose frameworks: Symphony, Laravel, CodeIgniter, Phalcon, Yii, Zend, CakePHP...

· As well lots of components for every necessity.

PHP has a thriving, open source and friendly community. The majority of web hosts already have support for PHP and it’s database sister MySQL. So you can start right away.


Warning: Haters gonna hate
1_lczk5cwMcnRm-MrIUp9trg.png


Some “real” software engineers criticize PHP because is not “perfect”. Because PHP doesn’t have a beautiful syntax as Ruby. Or is not a secure as Python (if you don’t know what are you doing).

What I think is that these people (snobs?) envy us. Because us PHP coders, without “proper training” are doing great stuff and still have time for doing other things (like marketing). A great part of the internet is powered by PHP. It just works.

Haters understand: We entrepreneurs that use PHP are not trying to create beautiful and perfect code. We are focused on creating business and this programming language is just a practical tool to get the work done. Fast. Just ask Mark Zuckerberg.


A personal take

I will use this thread as some kind of brain-dump. My perspective will be as a lone coder. And I will share the tools and techniques that work for me. Of course out there are hundreds of different applications.

I just hope to help you that are starting and have no clue about PHP.

Feel free to ask any question regarding the language. What I can’t do is review any piece of code. That would be impossible for me.

I will start to create new posts about different aspects of the language in the next days.


PS: I make this thread with the hope for helping fellow entrepreneurs. Also to respond to @LightHouse's challenge about trying to create a gold thread (last 2018 summit).
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.
Last edited:

George Appiah

Silver Contributor
Read Fastlane!
Read Unscripted!
Speedway Pass
User Power
Value/Post Ratio
194%
Aug 16, 2018
278
540
44
Accra, Ghana
Following!

I was scheduled to travel to Vancouver, BC, Canada in September for a 1-year coding boot camp + internship with Red Academy. Spent over $1K on various VISA-related fees (application fee, biometric fee, medical tests, consultation, a truck-load of documentation, etc) --- and despite paying my fees in full, my visa application was denied... for not demonstrating I had access to sufficient funds to support myself in Canada (funny, as my application included a certified bank statement with over US$50k (equivalent) closing balance).

This was a triple play: my goals were to immerse myself fully in coding for a period of time (that's' why I wanted to be away from the family), get some real-world experience in a startup or agency setting, and accumulate points for "Canadian study/work experience" that I would use in a future skilled-worker immigration application.

I also wanted to test out if Vancouver is all it's cracked up to be, as that's the city I wanted to settle in... someday.

I'm currently following freeCodeCamp's coding projects, but I'll surely re-apply next year.

Looking forward to your future posts in this thread!
 
Last edited:

lowtek

Legendary Contributor
FASTLANE INSIDER
EPIC CONTRIBUTOR
Read Fastlane!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
332%
Oct 3, 2015
2,164
7,186
42
Phoenix, AZ
I always laugh at those that say PHP is dead.

I never learned it, because I'm not really a web guy, but I'm not gonna hate on it. It's a general purpose language that powers much of the web.

Look forward to reading the thread!
 

lowtek

Legendary Contributor
FASTLANE INSIDER
EPIC CONTRIBUTOR
Read Fastlane!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
332%
Oct 3, 2015
2,164
7,186
42
Phoenix, AZ
Following!

I was scheduled to travel to Vancouver, BC, Canada in September for a 1-year coding boot camp + internship with Red Academy. Spent over $1K on various VISA-related fees (application fee, biometric fee, medical tests, consultation, a truck-load of documentation, etc) --- and despite paying my fees in full, my visa application was denied... for not demonstrating I had access to sufficient funds to support myself in Canada (funny, as my application included a certified bank statement with over US$50k (equivalent) closing balance).

This was a triple play: my goals were to immerse myself fully in coding for a period of time (that's' why I wanted to be away from the family), get some real-world experience in a startup or agency setting, and accumulate points for "Canadian study/work experience" that I would use in a future skilled-worker immigration application.

I also wanted to test out if Vancouver is all it's cracked up to be, as that's the city I wanted to settle in... someday.

I'm currently following freeCodeCamp's coding projects, but I'll surely re-apply next year.

Looking forward to your future posts in this thread!

I did some of free code camp's stuff, and found it really valuable (that's how I discovered I'm not a web guy). I think if you complete it and make the most of it, you probably won't need the paid boot camp.

Moving to Canada from Ghana may require it, but your skill set will be up to par after finishing FCC.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

Smuggo

Bronze Contributor
Read Fastlane!
Read Unscripted!
Speedway Pass
User Power
Value/Post Ratio
155%
Apr 13, 2018
113
175
I think most people don't like PHP since it's really easy to make many errors. It's interpreted so you can make a mistake and still don't know about it until you check it on the website and then, bang, something crashed. Also for large applications it's really hard to operate on PHP code and a lot of developers are NOT doing XUnit testing... which is something fundamental. I had a lot of reschuldes in my previous work because frontend was messing around. :p
 

andrewsyc

Bronze Contributor
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
216%
Aug 14, 2017
91
197
Iowa
PHP gets a bad rap but that's mostly because it's so easy to get up and going with it and thus there is so much sloppy code out there.
 

Captain_Picard

Contributor
User Power
Value/Post Ratio
162%
Aug 21, 2018
13
21
Thanks for posting this OP. What are some tips to be a better PHP programmer?

Some general pointers I have come across are:

1) Comment everything. Explain what you did, what does this variable mean, what does it do, why did you build this code structure, etc...

2) Create from a security standpoint from the get-go. Regex, filter_var() everything coming in, sanitize every thing going out. Sanitize at the JavaScript level and sanitize at the backend.

What are some other tips you would recommend to be a safer programmer and to be able to get an application built faster and better?
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

ApeRunner

Very Fast on a Bike
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
326%
May 16, 2014
166
541
43
Cozumel
How to Start programming in PHP?

You will need a web host that supports PHP. Most web hosting providers already do. There are literally thousands.

Here is a list of popular web hosts:

· HostGator
· BlueHost
· SiteGround
· InMotion
· iPage
· A2 Hosting
· DreamHost
· MediaTemple

Stay away from GoDaddy. This company is very popular for domain registration, BUT, their hosting services are awful.

There are basically three levels for a web hosting account:

Shared account
Your site will be hosted among hundreds of other websites. So, this level is intended for websites with a lighter load of usage. You won’t have “root access”. That means you cannot install custom modules to your “server” and other advanced modifications.

Virtual Private Server (VPS)
Your site will still be hosted among other sites or “virtual servers”. But the number of neighboring accounts won’t be as big as in a shared account. You will have root access and can make modifications as if it were a single server for you.

Dedicated Server
A real server (machine) for you. You can configure your machine to your liking as in choosing RAM and hard disk options. You can make custom modifications to your server. Intended for websites with a heavy load of usage such as bigtime ecommerce sites.

One of the most important things in deciding which hosting provider to use is customer support. You’ll need a host that you can call 24/7.

Additionally, you could run PHP in a local environment (your PC) with a local server such as WAMP (Windows) or XAMPP (Windows, Mac, Linux).

I personally only work on web servers since there is where my sites and applications will run. There always be differences and incompatibilities between your local server and the web server.

How do I write the Code?

You could use Notepad or any text editor to write PHP. But that is not advisable. What you really need is an “IDE” (Integrated Development Environment) that’s is suited for PHP.

There are a lot of IDEs and text/code editor. I haven’t tried them all. But I’m pretty sure the best one is PHPStorm.

PHPStorm
phpstorm.png
Is a complete solution for all things PHP. Is a commercial product developed by a Czech company named JetBrains. The software is very mature and easy to use. It has everything. You can upload your files directly by the FTP protocol to your server and stay in sync.


Visual Studio Code code.png
VS Code is a code editor developed by Microsoft. It’s free and everybody is loving it. It has its own marketplace of extensions where you can add functionality to the program. It already comes with a PHP extension for working in this language.

You’ll have to be more of a techie to get started with VS Code.

I recommend PHPStorm for the non-engineer types.

Do you know a good hosting provider to recommend? Do you prefer another IDE or text editor for writing code?
 

MoneyPhantom

Bronze Contributor
Read Fastlane!
Read Unscripted!
Speedway Pass
User Power
Value/Post Ratio
224%
Aug 6, 2017
51
114
Germany
What are some other tips you would recommend to be a safer programmer and to be able to get an application built faster and better?

Expect the stupidity of other programmers misusing your code.
  • Encapsulate everything into classes as good as possible (private/protected).
  • Make your code as fault tolerant as possible even on the internals.
 

lowtek

Legendary Contributor
FASTLANE INSIDER
EPIC CONTRIBUTOR
Read Fastlane!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
332%
Oct 3, 2015
2,164
7,186
42
Phoenix, AZ
Whatever you do, do not use Vim as an IDE

lol

Vim is one of those things with a steep learning curve, but yields significant productivity benefits once you get over that curve. It's on my list of things to learn.
 

LittleWolfie

Silver Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
56%
Jun 28, 2018
951
531
Holbeach Hurn
Thank you very much, @ApeRunner , I'll follow this thread. Currently I program in JavaScript and have no clue about PHP

I do wonder if HTML/Javascirpt has started making PHP obsolet enow. After all a lot that couldn't be done with html in 94, now can be downn with html/js. On the other hand their are a lot of technologies that rely on PHP and companies may wan to maintian old systems rather than switch to new ones.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

SoftStone

Bronze Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
217%
Jan 15, 2018
75
163
Germany
I do wonder if HTML/Javascirpt has started making PHP obsolet enow. After all a lot that couldn't be done with html in 94, now can be downn with html/js. On the other hand their are a lot of technologies that rely on PHP and companies may wan to maintian old systems rather than switch to new ones.

HTML and JavaScript are frontend technologies. PHP is a backend technology. They're not competing. PHP can be used together with HTML to fetch the data from a database (PHP) and display it (HTML), for example. And HTML without PHP (or, for that matter, any other backend language) is only good for static websites. Check out my thread on web development, that may help you.

And yes, you can use JS on the backend, too. However, there are dozens of more established technologies on the backend, although JS on the backend seems to get popular. But don't follow the hype for hype's sake. Have a reason.
 
Last edited:

SoftStone

Bronze Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
217%
Jan 15, 2018
75
163
Germany
1) Comment everything. Explain what you did, what does this variable mean, what does it do, why did you build this code structure, etc...

Warning: this is going to get subjective...

Please don't comment everything. Or by that regard, every variable. Code should be readable without comments that explain what it does. If you can't express yourself in code, why do you think you can express yourself in comments? :)

It's better to comment why you did something, or give broad overviews of what specific files are for IMO. But not for every line.

What are some other tips you would recommend to be a safer programmer and to be able to get an application built faster and better?

1. Use a good framework on the backend. If you don't screw everything up, you'll be way safer that way and ship faster.
2. Learn about SQL Injection, XSS and other common security vulnerabilities
3. What developers want to make, hackers want to break. You'll have to understand the latter as well in order to be safe.
 
Last edited:

eliquid

( Jason Brown )
EPIC CONTRIBUTOR
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
519%
May 29, 2013
1,876
9,731
There is no way to use PHP without HTML

Maybe this was accidently mis-wrote.

But I write a ton of PHP that never touches or uses HTML. I have whole systems of PHP code that is just backend REST APIs and background processing via CMD line.

Did you mis-type this?
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

SoftStone

Bronze Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
217%
Jan 15, 2018
75
163
Germany
Maybe this was accidently mis-wrote.

But I write a ton of PHP that never touches or uses HTML. I have whole systems of PHP code that is just backend REST APIs and background processing via CMD line.

Did you mis-type this?

Sorry, you're right. I meant that, in the context of just a basic web app, it wouldn't be useful to use PHP to fetch data from a database without actually displaying it with HTML.

But yes, REST services that are meant to process or fetch some kind of data from 3rd party endpoints don't need HTML directly. Only at the end, it would be useful to actually display something to users on the web (if the API is meant for that purpose, and not a standalone product, which also exist)... that's what I meant but put in pretty lousy words ^^.

Thanks for making me aware of that. Will go back and correct that.
 
Last edited:

garyfritz

Silver Contributor
Read Fastlane!
Summit Attendee
User Power
Value/Post Ratio
116%
Jul 16, 2011
694
807
Colorado
Please don't comment everything.
+1. I have a friend -- a professional software developer who's been a full-time programmer for 30 years -- who insists on commenting EVERYthing to an absurd degree. I mean like this:

x = 0; // Set x to 0

IMHO it's ridiculous and it's hard to see the logic of the program behind all the "noise" of his extraneous comments.

It's better to comment why you did something, or give broad overviews of what specific files are for IMO. But not for every line.
That's closer to what I do. Give a brief description of what's happening before a section of code, with a short explanation of what you're doing and why. Those comments give a high-level view of what's happening in that section. You can understand a large piece of code by reading the comments associated with each "paragraph," only diving into the code for sections you need to understand in detail.

With that introductory comment, the code in the section should be easy to understand. If something in the section isn't obvious, go ahead and add a comment to that code. Something like this:

// Frobunize the encabulator, then use it to build the next radial wotsit.
// Once we have enough wotsits, feed them into the augmented flappenizor.

Encab = x + y / 23;
Ulate = sin(time_seconds); // Determine the rotational velocity of time
Whatever = Frob(Encab, Ulate);

Wotsits[Wots++] = HypergolicInverse(Whatever);
if (Wots > Enough)
Flappen(Wotsits);
 

SoftStone

Bronze Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
217%
Jan 15, 2018
75
163
Germany
// Frobunize the encabulator, then use it to build the next radial wotsit.
// Once we have enough wotsits, feed them into the augmented flappenizor.

Encab = x + y / 23;
Ulate = sin(time_seconds); // Determine the rotational velocity of time
Whatever = Frob(Encab, Ulate);

Wotsits[Wots++] = HypergolicInverse(Whatever);
if (Wots > Enough)
Flappen(Wotsits);

Let's not get too nit-picky in this thread, but in that scenario, I'd probably create a function called frobunizeEncabulator() or something like that instead of commenting.

For anybody reading: I'd recommend Clean Code by Robert Martin if you want to improve your coding style. Great read. Although the examples are written in Java, they apply to pretty much any language.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

garyfritz

Silver Contributor
Read Fastlane!
Summit Attendee
User Power
Value/Post Ratio
116%
Jul 16, 2011
694
807
Colorado
Yes. If the variables / functions can be self-documenting, they should be. I was trying to convey a more complex logic flow than could be captured in individual names, without making my example too large.
 

LittleWolfie

Silver Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
56%
Jun 28, 2018
951
531
Holbeach Hurn
.HTML and JavaScript are frontend technologies. PHP is a backend technology .

JavaScript isn't a front end technology, it is used commonly on the front end though.

And yes, you can use JS on the backend, too. .
That's how you know it isn't a front end technology, you can't use HTML on the back-end.

Though for a basic understanding your approach is perhaps an acceptable oversimplification, it just hit a personal hot button for me.

. They're not competing.

They are, because you can use a MEAN stack instead of a LAMP stack.
But don't follow the hype for hype's sake. Have a reason.

I agree. A requirement to access the local data or camera/audio on a device is a good reason to use JS. Or maybe using it is in your specification. If it's the language your most familiar with that's a another good reason of course.


+1. I have a friend -- a professional software developer who's been a full-time programmer for 30 years -- who insists on commenting EVERYthing to an absurd degree. I mean like this:

x = 0; // Set x to 0

IMHO it's ridiculous and it's hard to see the logic of the program behind all the "noise" of his extraneous comments.

Probably, because any professional can quickly and easily ignore or toggle off all those comments.
 

ApeRunner

Very Fast on a Bike
Read Fastlane!
Read Unscripted!
Summit Attendee
Speedway Pass
User Power
Value/Post Ratio
326%
May 16, 2014
166
541
43
Cozumel
@LittleWolfie How do your comments HELP non-engineers that DO want to learn PHP?

Because if you want to talk about JavaScript this is no the thread for that.
 
Dislike ads? Remove them and support the forum: Subscribe to Fastlane Insiders.

LittleWolfie

Silver Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
56%
Jun 28, 2018
951
531
Holbeach Hurn
@LittleWolfie How do your comments HELP non-engineers that DO want to learn PHP?

1) It makes them aware that their are alternatives, which will increase their chances of understanding client ads.

2) will get non enginners wanting to learn PHP who come across this thread in the future to double check if this is still viable then.

After all non developers ate less likely to be able to make that judgement call when they come across sites promoting FORTRAN and the like.

To be fair you did gloss over other languages, I just think you may have had too little emphasis on that.

I'm suprised you have yet to mention imperative and p.o. coding style,since that's a PHP strength and can quickly seprate people into the easiest learning style for themselves personally.

Then again the qualification and work I did was mainly on teaching people to use the software/programming (ITIL tutoring + principles+ post grad teaching qual) rather than learning for money. Perhaps my style of instruction is better suited for employees.

I could have made more meat out of the IDE and code commenting, however I wanted to avoid distracting from your tutorial too much.
 

SoftStone

Bronze Contributor
Read Fastlane!
Speedway Pass
User Power
Value/Post Ratio
217%
Jan 15, 2018
75
163
Germany
They are, because you can use a MEAN stack instead of a LAMP stack.

In the context of this thread, they're not competing. If you plan on using PHP on the backend (which this thread was made for), you're not going to use the MEAN stack (no, we won't go into microservice architectures now :))

Just to add some more value to the beginners reading this: keep things simple. No need to overcomplicate stuff at the beginning. Also, terminology is very often vague (things like "frontend developer" or "entrepreneur" have varying definitions, depending on who you ask).
 

Post New Topic

Please SEARCH before posting.
Please select the BEST category.

Post new topic

Guest post submissions offered HERE.

Latest Posts

New Topics

Fastlane Insiders

View the forum AD FREE.
Private, unindexed content
Detailed process/execution threads
Ideas needing execution, more!

Join Fastlane Insiders.

Top