User Controls
I learned to PHP
-
2016-02-15 at 10:49 PM UTC<?php
echo 'hi';
?>
so fucking awesome... -
2016-02-16 at 4:22 AM UTCI already know that much. Teach me more.
-
2016-02-16 at 4:23 AM UTCis that the php hello world program?
Teach more cuz printing stuff is pretty fuckin basic. -
2016-02-16 at 4:24 AM UTC<?php
while(!crunk){get(crunk)};
?> -
2016-02-16 at 4:46 AM UTC
-
2016-02-16 at 4:57 AM UTCI actually don't mind it; I use it mostly for straightforward web-based tools. it's flexible, relatively light, easy to deploy and hard to fuck up
-
2016-02-16 at 5:14 AM UTC
I actually don't mind it; I use it mostly for straightforward web-based tools. it's flexible, relatively light, easy to deploy and hard to fuck up
What do you do for a living, Aldra? If I can ask.
Are you a hobbyist? -
2016-02-16 at 5:30 AM UTC
-
2016-02-16 at 5:32 AM UTCIt is light and easy to deploy. Is it flexible? I mean it is malleable but I don't think you need a program to get all that big before changing the system becomes more difficult as a product of that malleability which I think is, in some sense, contrary to the idea of software being flexible. Also I think the abundance of footguns and kinda batty defaults makes it trivially easy to fuck up.
I mean it has its place and a lot of what are clearly poor decisions today can be explained by the fact that it was designed for CGI scripts, although the fact that mod_php has been like 99% of how PHP gets executed for a long time now, across multiple major version releases, and the language still pretends like "pipe stdout to a socket" is how people use it seems to suggest this isn't actually a valid excuse anymore. I'd almost prefer perl, that way I could at least feel cool when producing eye-bleed inducing one liners. -
2016-02-16 at 5:51 AM UTCI do prefer perl, lel. for the most part I use perl for backend scripts and php for user interaction.
not sure what you're referring to in the first paragraph without specifics, but by flexibility and hard to fuck up I meant I haven't come across anything it's abhorrently bad at (though I have a tendency to hack shit together instead of worrying about their libs and standards) and data/type handling is a lot simpler (both good and bad) than a lot of other languages. you don't have the same issues with data/pointers and memory locations like in c, or translating between arrays-refarrays-hashes-etc like in perl, and as a result I find troubleshooting and error handling to be pretty straightforward. PS. keep in mind I don't use object syntax.
also I don't bother using php for anything that runs outside of the browser.What do you do for a living, Aldra? If I can ask.
Are you a hobbyist?
yeah, though I'm not into it as much as I used to be.
job title is sysadmin/developer, mostly entails managing some network hardware, local and amazon VMs, and devops which is writing tools and scripts for internal systems... biggest things I've done recently have been LDAP management and synchronisation with internal databases, reporting engines and stuff like that (getting a lunix webhost to pull mailbox information from office365 was tricky). -
2016-02-16 at 7:28 AM UTC
not sure what you're referring to in the first paragraph without specifics, but by flexibility and hard to fuck up I meant I haven't come across anything it's abhorrently bad at (though I have a tendency to hack shit together instead of worrying about their libs and standards) and data/type handling is a lot simpler (both good and bad) than a lot of other languages. you don't have the same issues with data/pointers and memory locations like in c, or translating between arrays-refarrays-hashes-etc like in perl, and as a result I find troubleshooting and error handling to be pretty straightforward. PS. keep in mind I don't use object syntax.
So one of the big ones is the tendency of people to pass around associative arrays rather than objects. I'm not a big OOP person but just a data object analogous to a struct would be fine, the issue comes when you have no schema, you're holding onto a thing and your only way to know what its structure is is by r_printing it, and you'll never know if the next similar looking thing is going to have the same keys or not. That's the crux of the flexibility complaint at least. There's also a culture of mutating arguments that toxically interacts with the former custom which, ok, if we're comparing with something like C then it's not significantly worse but I think one of the most important things we'd like to see out of a high level language, the reason we pay so many cycles for an interpreter and high level constructs is to get tools that are slower but easier to reason about and "here's a thing, when control returns (and god only knows how much time has passed or how system state has changed) it's going to be different" is the opposite of easy to reason about, even if we're not worried about concurrency (which we should be). Then there's the whole "everyone is in the global namespace by default" thing, pervasive reliance on globals, and clunky ass NS system for people who do try to do the right thing. -
2016-02-16 at 8:28 AM UTCWhen I read about globals in php5, I couldn't believe what Im reading. Even more so when I read about its relationship with mysql. You could get more good out of writing websites in bash. I mean, for god's sake, it's a templating language! I always marvel at how some companies build huge applications using php - anything else would be better, even god damned java.
That said, I do see a certain need for PHP, at least a bare minimum of knowledge necessary to throw up a simple script on a free/1cent-per-year host. After reading up on it, I understand why hordes of people own up to knowing this language, but I can't imagine why'd anyone focus on it and stick with it if there are alternatives such a ruby/python/lua/etc. out there. -
2016-02-16 at 3:48 PM UTCIf you have to define functions by actually typing the word function and have to put brackets and arrows everywhere thats2verbose4me.
<?php
function writeMsg() {
echo "Hello world!";
}
writeMsg();
?>
What's even up with the silly brackets?
def hello():
print "Hello world!"
hello()
As demonstrated by this simple example, python is superior in all respects. -
2016-02-16 at 7:12 PM UTC
If you have to define functions by actually typing the word function and have to put brackets and arrows everywhere thats2verbose4me.
<?php
function writeMsg() {
echo "Hello world!";
}
writeMsg();
?>
What's even up with the silly brackets?
def hello():
print "Hello world!"
hello()
As demonstrated by this simple example, python is superior in all respects.
-
2016-02-16 at 7:22 PM UTC
If you have to define functions by actually typing the word function and have to put brackets and arrows everywhere thats2verbose4me.
<?php
function writeMsg() {
echo "Hello world!";
}
writeMsg();
?>
What's even up with the silly brackets?
def hello():
print "Hello world!"
hello()
As demonstrated by this simple example, python is superior in all respects.
<?php
namespace core\system;
class System
{
private $controller;
private $controller_name;
public function __construct()
{
$this->controller = new $this->controller_name;
}
private function create_controller()
{
}
}
[COLOR=#0086B3][FONT=Consolas][SIZE=12px]\Core\System\System::[/SIZE][/FONT][/COLOR][COLOR=#333333][FONT=Consolas][SIZE=12px]create_controller();[/SIZE][/FONT][/COLOR]
System::
what's the equivalent in python? -
2016-02-16 at 9:56 PM UTC
<?php
namespace core\system;
class System
{
private $controller;
private $controller_name;
public function __construct()
{
$this->controller = new $this->controller_name;
}
private function create_controller()
{
}
}
[COLOR=#0086B3][FONT=Consolas][SIZE=12px]\Core\System\System::[/SIZE][/FONT][/COLOR][COLOR=#333333][FONT=Consolas][SIZE=12px]create_controller();[/SIZE][/FONT][/COLOR]
System::
what's the equivalent in python?
No idea, i can't read this mumbojombo. Tell me the purpose of it and i'll make an equivalent in python. -
2016-02-17 at 2:53 AM UTC
what's the equivalent in python?
It looks like you lost part of your example, presumably "System::" wasn't the end since I'm pretty sure that's not valid syntax. -
2016-02-17 at 12:27 PM UTC
It looks like you lost part of your example, presumably "System::" wasn't the end since I'm pretty sure that's not valid syntax.
yup