The online racing simulator
#1 - kyler
Can anyone. [help me with this code]
can anyone tell me what is worng with this code?
while(list($struct, $items) = each($structs)) {
$default = new stdClass;
$size = 0;

while(list($item, $idef) = each($items)) {
$default->{$item} = NULL;
list($datatype, $defval) = explode(':', $idef, 2);

if (NULL !== $defval) {
$default->{$item} = $defval;
}

Uhh, whats it for?
I see explode, so maybe thats why It's not working?!

Honestly, I don't know, but pasting such a small bit of the code isn't so helpful.
Quote from dawesdust_12 :I see explode, so maybe thats why It's not working?!

I do have to give PHP one thing, it has some cool function names.

kyler - perhaps if you told us what it is supposed to do, and what it is doing instead (i.e. where it's going wrong), it would be easier for us to help you.
#5 - kyler
Quote from Bob Smith :I do have to give PHP one thing, it has some cool function names.

kyler - perhaps if you told us what it is supposed to do, and what it is doing instead (i.e. where it's going wrong), it would be easier for us to help you.

well its for a cruise insim and when i launch it and it connects but i get undefined index and it says in the file and on that line i copyed it but if u have like msn or somthing ill show u the code. nevermind i pmed it to u
#6 - kyler
Quote from kyler :well its for a cruise insim and when i launch it and it connects but i get undefined index and it says in the file and on that line i copyed it but if u have like msn or somthing ill show u the code. nevermind i pmed it to u

here is another error.

<?php 
  
function __construct ($parent NULL) {
   
$this->parent $parent;
   
$this->amount $this->parent->config['money.amount'];
   
//$this->setTrackingRate(1000);
  
}
?>

Thanks in advance.
Quote from kyler :well its for a cruise insim and when i launch it and it connects but i get undefined index and it says in the file and on that line i copyed it but if u have like msn or somthing ill show u the code. nevermind i pmed it to u

Undefined index is usually a notice rather than an error. It just means whoever originally wrote it wasn't using good practise, and was probably coding with notice's suppressed (modify error_reporting in php.ini to change this behaviour in your copy). The code should continue working after a notice or a warning. Errors stop the code.

Quote from kyler :here is another error.

<?php 
  
function __construct ($parent NULL) {
   
$this->parent $parent;
   
$this->amount $this->parent->config['money.amount'];
   
//$this->setTrackingRate(1000);
  
}
?>

Thanks in advance.

Giving code without the error is useless. There's no "error" there, in terms of syntax, and that's all we can get from that. We either need the rest of the code, or the exact error message (preferably the error message).
#8 - maczo
Quote from kyler :here is another error.

<?php 
  
function __construct ($parent NULL) {
   
$this->parent $parent;
   
$this->amount $this->parent->config['money.amount'];
   
//$this->setTrackingRate(1000);
  
}
?>

Thanks in advance.

Maybe when construct is called without $parent and $parent is NULL then you can't access $this->parent->config (effectively: $this->NULL->config).
That's my guess.
Quote from maczo :Maybe when construct is called without $parent and $parent is NULL then you can't access $this->parent->config (effectively: $this->NULL->config).
That's my guess.

Again, that should be a warning Not an error if I remember correctly, so the code should continue running...
ok to clear everything up here are the errors
Quote :PHP Notice: Trying to get property of non-object in C: on line 29

<?php 
$this
->amount $this->NULL->config['money.amount'];
?>

Ok now error #2 PHP Notice: Undefined index: on line 67

<?php 
if (sizeof($self->events[$ev]) < 1)
?>

And there is a problem with this one

<?php 
                
while(list($item$idef) = each($items)) {
                    
$default->{$item} = NULL;
                    list(
$datatype$defval) = explode(':'$idef2);
?>


Hope this clears things up.

FGED GREDG RDFGDR GSFDG