I love PHP! How can I do more than just build websites with it?

I see that the Javascript syntax is being used everywhere these days. I took some small online courses for Unity3d ( a game engine ) and seen that you can write scripts in the engine in Javascript. It got me thinking, why don’t they use PHP! Also, I’m into embedded electronics as well and this new board called the Onion Omega also supports embedded programming using PHP.

So this is an open ended question to see what else I could do with my PHP knowledge.

Like for example, is there any way I could write an application in PHP that doesn’t require an interpreter? I see that there is some efforts made to write GTK front ends with PHP, but I’m not sure how far that gets me…

Any suggestions or related discussion highly welcome and appreciated!

Well, you need to understand PHP vs Java or Javascript! They are totally two different worlds!

First, you must remember you are discussing two different things. A “CLIENT-SIDE” and a “SERVER-SIDE” systems.
The server runs PHP and other languages. It does NOT run Javascript as that would give everyone full access to your
server’s system and all it’s data. When you process a PHP file, it is done on the server which protects that code from
the world of hackers. Once it is completed, it’s “OUTPUT” is combined with your HTML and sent to the browser. You never
see any PHP code in any webpage on the world. RIGHT-CLICK on ANY page in the world and you can view all of their
HTML code, their CSS code and unprotected Javascript. You also can see lists of the external files they use such as any
external CSS files used. These can be downloaded. But, you will never see any of their PHP code unless it is listed in
their webpage as text. (Such as you do here!)

Next, the client side of the process is really your “BROWSER” or an app that uses an embedded browser. Therefore, as
you mostly likely now understand, this coding is done on the local computer that is being used to view a webpage. And,
this means it can communicate with a server, but, has no control over the server itself. This is for security issues as you
can now understand. I use Unity and love it. The engine has a lot of controls and things that need to be controlled in the
client-end of the system. Therefore, Javascript is used. This of course can pull data from the server by calling PHP pages
which can access the server’s database, etc and then send data back as .JSON formats or whatever is needed. But, it does
not have full access to the server.

So, in my opinion, ANYTHING, or perhaps, EVERYTHING, is possible in programming. But, security makes the PHP end of
it all locked into the server. This protects you from the crazies in the world! Now, if you are looking for a project for your PHP
skills, that is another subject all together… I have millions and never seem to get to any of them. LOL

Well, hope that made sense to you. Yes, you can do Unity type of coding with PHP, but, it is not really a gaming engine as it
can not do anything on the client-side! But, that is what Unity’s browser plug-in does.

See you in the 'Bitstream… (That is all this really is… LOL)

Thank you for reply. I’m aware of the difference between client and server side programming. But it’s important to note I’m just talking about the syntax and the core functions of PHP. When Javascript is being used to program 3d games in Unity3d, it’s not the same Javascript that is used in a web browser. It’s just using the Javascript syntax and structure. I wish I could do that with PHP as I adore how fast it is to write script and especially love it’s freedom with arrays and functions.

Javascript also runs on the server side now as well as the client side using things like Node.js, but obviously javascripts running on Node.js are not visible to the client.

Cheers.

For me it’s pretty much about choosing a tool for the job. Often that tool is chosen by what the people behind the stack knows from before, often it’s based on opinions (loose vs strict types, functional vs oop, etc). I’m sure Unity added “JS” as it’s one of the really “hip” languages atm, plus a lot of devs have used it before. The few hours I’ve spent with Unity was with C#. I’ve grown to really enjoy the benefits of stricter typing, and because of that appreciate what’s going on with PHP/Hacklang and TypeScript for JS.

You can easily do shell scripts in PHP (just execute with php), which at least used to make a ton of sense as teams had their entire app stack in PHP so automating builds etc in the same language was effective and easy.

I’ve also seen “compilers” (more like wrappers) that would allow you to run PHP as a desktop app. I’m not sure I see the use for it, and since no-one seem to be using it that might be true.

I will use PHP for larger web apps as it’s what I know best, and I love building complex “enterprisy” apps with Symfony. I usually use Python for cron/shell scripts, guess it just became a habit. I’ve used NodeJS quite a bit for smaller APIs/socket apps, but I’d probably try using Go if I were to do another one of those today. Last time I used Go I felt constrained as there were so few libs and docs available, it’s a few years ago though and the state of it seems much better for my use today.

Not sure if I came close to answering your question (?). But I believe you shouldn’t decide to use - or strive for- one technology or solution everywhere, it drastically limits your opportunities as a programmer.

JimL, you are always full of a lot of info… Thanks! Way ahead of me most of the time! I want to say that I agree 100% on using the best language or tool for the project at hand. It is always an issue that needs to be sorted out before jumping into a new project.

wh33t, If you want to use Javascript (not Java, which is a different item) along with PHP, you can use both and just communicate between them using AJAX/JSON or whatever transport you need. So, it is doable as long as you sort out the security issues of sending data between them.

Oh, JimL, I am starting a new project with Unity and C#, but, mostly will be a PHP database sending data to a web-based Unity display. So, I will keep you in mind as my C# has been out of my mind for many many years. Just have not needed it much in a very long time! Since MS gives it away now, at least it doesn’t cost anything to get up to date…

Yes, wh33t, think this is not an answer really… Was there really a question? LOL

Okay, after re-reading your subject line, I am thinking you are looking for ideas what to do next. Was that your question?
If so, what line are you thinking about? What are your hobbies? Bet we could help you with ideas…

Sponsor our Newsletter | Privacy Policy | Terms of Service