The online racing simulator
Changes in PHP 5.4, and how this effects PRISM.
There have been some changes in PHP 5.4 in how arrays work, specifically, array dereferencing. So what is array dereferencing? Well, simply it allows for things like this:


<?php 
public function onClientConnect($UCID)
{
    echo 
$PRISM->getClients()[$UCID]->UName;
}
?>

In our old code, we would have to do:


<?php 
public function onClientConnect($UCID)
{
    
$Clients $PRISM->getClients();
    echo 
$Clients[$UCID]->UName;
}
?>

So, it just cleans up some syntax noise from some of our code. When 5.4 becomes stable, expect for PRISM to upgrade to this version as it's minimum requirement.
Lol, I thought it was possible in 5.2 and 5.3 by using {} or normal way too...
Kinda, it's referred to as complex strings in that case, but only works in that context. This moves it into a first class status.
ick. it wont break backwards compatibility will it? (plugin wise)
No, it's just an upgrade. If anything, I'll be using it in the modules that I made to make the code cleaner, but otherwise, you won't notice anything different. Everything should just be a little bit faster is all, and more concise. Reading though this example, gave me the idea for the object dereferencing that I'm using in the packet module for the quick one line solution for packets.
Worth updating the plugin to use the same format? much faster or?
When I get around it, I'll do some benchmarks. But seeing as it uses one instruction to read the data as apposed to two, I would say that it should be twice as fast. But I'll get some hard data and see what it is.
If you do benchmarks, please also benchmark
'foo'.$packet->var.'bar'
against
"foo{$packet->var}bar"

Quote from GeForz :If you do benchmarks, please also benchmark
'foo'.$packet->var.'bar'
against
"foo{$packet->var}bar"


intrested in this aswell
In PHP 4, first version ''.'' was faster.
I think they made the complex string version much faster by PHP 5, so that it's at least on par with '.', no idea what it is now days with PHP 5.3, or 5.4.

FGED GREDG RDFGDR GSFDG