123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|256|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Web Development -> PHP8

Posted : Friday, 11 December 2020, 08:14
Jayenkai

PHP8


PHP8's been out for a little while. Every time I visit php.net for clues as to how the hell to do things, it's been up there at the top, letting me know my whole empire of websites will soon come crashing down!

Release Notes

Examples include the ability to change this lovely bit of readable code


into this unreadable mangled confounded mess


Eeeeuw Yuk...

PHP8 is available now.
Upgrade at your peril!

..Currently trying to come up with the best way to test the site without upgrading the server.
I wonder if my NAS can do it..?

-=-=-
''Load, Next List!''
Posted : Friday, 11 December 2020, 08:18
rychan
26th of November, not that long then Have decided to upgrade our systems at work to it come January, scary stuff as some of our code dates back to 2002, gonna be a lot of late nights I fear!

It's weird that they say improvements in readability with some stuff, that looks way less unreadable!

-=-=-
Web / Game Dev, occasionally finishes off coding games also!

Refresh Games - Game Dev Blog
Posted : Friday, 11 December 2020, 13:29
therevillsgames
Same with the new syntax in C# and Java...

At the end of the day a programming language should be readable to humans first.
Posted : Sunday, 07 March 2021, 04:38
Jayenkai
Having finally got an install of PHP8 to run on my laptop, I'm finding a whole host of issues in the SoCoder/AGameAWeek scripts that would fail if I upgraded the server.
We'll probably stick with PHP7 until I've fixed them all.

The biggest issue is that PHP8's abs() function now only works strictly with numbers. I've used abs() as a failsafe "check that this is a number" for the past decade or so, and the scripts are FULL of instances where I've used it to convert strings to numbers.
Fuxake.. Going to have to rewrite tons of stuff, and dump intval() all over the place.
It's a security thing, though. I'm not convinced that intval() is as secure as simply using abs() was.
I might have to trawl through the docs to find the safest way to do number checking, without resorting to a regex.... Though, that's likely the safest way to do it, now.

-=-=-
''Load, Next List!''
Posted : Sunday, 07 March 2021, 04:41
Pakz
Is there no thing like overide functions? Where you write a function that handles it and the language compiler replaces it? I'm not that familiar with that though and barely used this feature in languages.
Posted : Sunday, 07 March 2021, 04:45
Jayenkai
I did consider that, or even replacing all the abs() references with an Abs() function, and writing my own that way.
Thing is, though, the scripts are all over the damn place, and "include" one thing after another. As much as that "should" work, there's always the possibility that one script will load that doesn't have the Abs function already included!!

-=-=-
''Load, Next List!''
Posted : Sunday, 07 March 2021, 10:02
rychan
For extra speed, you can just (int)$variable but it depends on the data you're using I guess.

Before January I was looking at upping our server to PHP8 only to be informed that it wasn't compatible with our software, which is a relief in all honesty, work's gonna be crazy busy this year anyhoo!

Which code editor do you use btw? I've found textpad to be really handy for multi-document replacements, does the job really quickly.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!

Refresh Games - Game Dev Blog
Posted : Sunday, 07 March 2021, 10:29
Jayenkai
I used to use Programmers Notepad 2. But that was a long time ago..
I'm on Mac, now!!!

I now use TextMate, which has a really handy shortcut. Shift+Alt+R will run your script in PHP, assuming it'll run that way on your desktop.. anything requiring an SQL server is out of bounds.
But if you're doing what I'm doing, and moving from decades of little Blitz scripts, to rewriting them as PHP scripts instead, then it's really handy to be able to open the script, and hit a keypress to run it.

-=-=-
''Load, Next List!''
Posted : Sunday, 07 March 2021, 11:32
rychan
Cool, so, kinda like command line interface to it, nice!

-=-=-
Web / Game Dev, occasionally finishes off coding games also!

Refresh Games - Game Dev Blog
Posted : Sunday, 07 March 2021, 14:32
Jayenkai
Indeed. I think of it like running a .bat file, and it's super handy for that purpose. PHP's way more functional than I could ever hope to achieve from a .bat!!

Oh yeah, and fast, too, since you don't have to wait for that quirky delay that Blitz always has when running!!

-=-=-
''Load, Next List!''
Posted : Sunday, 07 March 2021, 16:03
rychan
Lovely