Jump to content
Ssociety

PHP

Recommended Posts

Base from your experience as a programmer, Is it worthy to focus in this language when it comes to web development? for me I find it easy to use, but when I am building more complex systems it creates shitty mess that I really hate, I'm trying to avoid mess when I am coding but I can't when it come to php..

Share this post


Link to post
Share on other sites

For me,  yes especially if you are doing freelance. Most websites are php based due to CRMs such as Wordpress. Websites using WordPress is the common thing for small and starting businesses or bloggers cuz it's cheap. 

Tldr, trend wise, it's a yes. But coding wise, it's a no. I prefer other OOP PLs like. Net

Share this post


Link to post
Share on other sites
18 hours ago, Mistletoe said:

For me,  yes especially if you are doing freelance. Most websites are php based due to CRMs such as Wordpress. Websites using WordPress is the common thing for small and starting businesses or bloggers cuz it's cheap. 

Tldr, trend wise, it's a yes. But coding wise, it's a no. I prefer other OOP PLs like. Net

Yeah you are right, maybe I will focus first on other programming languages, I am choosing from javascript or java

Share this post


Link to post
Share on other sites

Knowing a bit of PHP isn't a bad thing - it's very commonly-used, and gives you the freedom to fiddle around in the backend if you ever end up having to manage something like a Wordpress site.

But if you're trying to build an application from scratch with it, it's really advisable that you learn up on common design patterns beforehand (MVC and its variants are important). You can technically achieve your goals without following a structure, but if you ever have to look back to maintain/extend some functionality...that's where the nightmare begins. (Learning design patterns isn't specific to PHP; any language becomes a tangled mess if you don't follow one in a large enough program. That's why programming is a skill that transcends languages - it's more of a way of thinking than knowing any particular language. Once you have that down, the only real barrier from using another language is learning the syntax.)

Share this post


Link to post
Share on other sites

Honestly, I have no experience working in the programming industry, So I want to focus in a language that will be a nice training ground for a newbie like me, I Tried to apply in this small company in our place, they are using php as their main programming language, I guess I will stay their for a year If I get Hired :). I want to learn node.js more though..

Share this post


Link to post
Share on other sites
4 hours ago, Ssociety said:

Honestly, I have no experience working in the programming industry, So I want to focus in a language that will be a nice training ground for a newbie like me, I Tried to apply in this small company in our place, they are using php as their main programming language, I guess I will stay their for a year If I get Hired :). I want to learn node.js more though..

Php is a nice training ground. To give you an idea of the whole picture, creating a website is composed of 3 section. 

- Your front end (your website interface)

- your back end (where your coding, conditions, actions will be)

- your database (where you store your data, images,  sounds etc)

 

For front end, you use html,  css for the design. To make it dynamic, you use javascript, jquery, node.js and other variations of javascript. This is what also used to communicate from your front end to your back end. 

 

For back end, you use whatever programming language you prefer. Be it php, java, c#, vb etc

 

Database, you use whatever fits your program. Depending on the size of your project. Query is what you use to communicate from your back end to database 

 

As you can see,  this can be so complicated especially if you're not the one who coded it and you have to update it. This is where proper naming of variables, functions, classes and comments comes in. This is what @Serlite is referring to with design patterns. You may wanna search Gang of Four for this. 

Edited by Mistletoe

Share this post


Link to post
Share on other sites
On 30.10.2017 at 11:21, Mistletoe said:

Once you know 1 programming language, it is easy to learn other programming language. The idea is the same, they just differ in syntax. :)

Yep.. its all pretty the same. 

On 30.10.2017 at 07:22, Ssociety said:

Even if I am the one coding my own program , when I leave the code  for a month , I can't understand it anymore and I am annoyed , maybe I should be more detailed in naming variables and be more organize .. :D

Think of reading a sentence... 

// small dicing php function

// Variable 'Bet' is describing how much the player wants to throw into the pit of gambling 
$bet = 0.001;

// Varbiable 'chance' is describing the chance to win
$chance = 50.00;

// Variable 'balance' is describing what amount of money the player has
$balance = 5.000;

// create a function named 'gamble' and get variables $bet and $chance - $balance is there to be added by $outCome
func gamble($bet, $chance, $balance) {

// if $rand is smaller than $chance, double the bet and pay out
	if $rand < $chance {

// little math for the win
    	$outCome = 2 * $bet;
                      
// Add the outcome to the balance of the player
        $newBalance = $balance + $outCome

// return the new balance
        return $newBalance;
    } else {

// little math for the win
    	$outCome = 2 * $bet;
                      
// substract the outcome to the balance of the player
        $newBalance = $balance - $outCome

// return the new balance
        return $newBalance;   
    }
}
                      
// print the function:
print(gamle($bet, $chance, $balance));

The // blabla stuff are comments. Thats how I would read the syntax of this basic easy function. 

Don't use this func.. its to basic and not well done.. just wanted to show you what you need to learn.

Make it readdable.. put comments in the right place and it should work out. Variables should always have a name, that make sense and are easy understandable.

My code may be wrong.. didn't work with php for a while. Oh and forgot to add a variable that rands up a number between 0.00 and 100.00. not important for the example.

Edited by CaptainLorca

Share this post


Link to post
Share on other sites
6 hours ago, CaptainLorca said:

Yep.. its all pretty the same. 

Think of reading a sentence... 


// small dicing php function

// Variable 'Bet' is describing how much the player wants to throw into the pit of gambling 
$bet = 0.001;

// Varbiable 'chance' is describing the chance to win
$chance = 50.00;

// Variable 'balance' is describing what amount of money the player has
$balance = 5.000;

// create a function named 'gamble' and get variables $bet and $chance - $balance is there to be added by $outCome
func gamble($bet, $chance, $balance) {

// if $rand is smaller than $chance, double the bet and pay out
	if $rand < $chance {

// little math for the win
    	$outCome = 2 * $bet;
                      
// Add the outcome to the balance of the player
        $newBalance = $balance + $outCome

// return the new balance
        return $newBalance;
    } else {

// little math for the win
    	$outCome = 2 * $bet;
                      
// substract the outcome to the balance of the player
        $newBalance = $balance - $outCome

// return the new balance
        return $newBalance;   
    }
}
                      
// print the function:
print(gamle($bet, $chance, $balance));

The // blabla stuff are comments. Thats how I would read the syntax of this basic easy function. 

Don't use this func.. its to basic and not well done.. just wanted to show you what you need to learn.

Make it readdable.. put comments in the right place and it should work out. Variables should always have a name, that make sense and are easy understandable.

My code may be wrong.. didn't work with php for a while. Oh and forgot to add a variable that rands up a number between 0.00 and 100.00. not important for the example.

wow, you are a really big ass developer T>T 

Share this post


Link to post
Share on other sites
5 hours ago, CaptainLorca said:

not at all.. but that is easy to understand and every coder is coding this way. make it as easy as possible to read. And always try to use as less lines as neccessary.

yeah I am trying to be more organize when it come to coding, but i having a hard time doing that hahah.. I am inborn disorganized lol xD 

Share this post


Link to post
Share on other sites
15 hours ago, Ssociety said:

yeah I am trying to be more organize when it come to coding, but i having a hard time doing that hahah.. I am inborn disorganized lol xD 

The basic designing pattern then move to a bit high level designing pattern like GoF(gang of four).

Im a very OC person soooo keeping my program neat is my forte xD

Share this post


Link to post
Share on other sites
6 hours ago, Mistletoe said:

The basic designing pattern then move to a bit high level designing pattern like GoF(gang of four).

Im a very OC person soooo keeping my program neat is my forte xD

my forte is creating programs that I am the only one who understands hahahah lol xD maybe because all of my life I am the only one who codes here so I don't usually care for others to read my codes hahah

Share this post


Link to post
Share on other sites
4 hours ago, Ssociety said:

my forte is creating programs that I am the only one who understands hahahah lol xD maybe because all of my life I am the only one who codes here so I don't usually care for others to read my codes hahah

The soloist xD.

Youll have a problem on this once you will need to update your program or add new features. 

Not to mention if someone else is going to update your program xD

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×