Re: [PHP] nested if parse error

2002-05-31 Thread Miroslav Figlar

  could somebody explain me please what is wrong with this
  piece of code?
  ?
  if (1):
  if (1) echo hello;
  else:
  endif;
  ?

  Well, first off you've broken the golden rule, which is: Don't mix the
:-type syntax with the {}-type or completely bare syntaxes.

 In more detail:  on reaching the else, PHP matches it with the nearest
preceding if; this is the If (1) echo ... line, which isn't using :-type
syntax, so it expects the else also not to use :-type syntax -- so the : is
a parse error.

now it's clear to me
anyway it's funny that this works fine :-)
?
if (1):
if (1) echo hello;
$a = 1;// here can be anything else
else:
endif;
?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] nested if parse error

2002-05-30 Thread Miroslav Figlar

could somebody explain me please what is wrong with this piece of code?
?
if (1):
if (1) echo hello;
else:
endif;
?

it gives me parse error on line 4

this works fine (no parse error):
?
if (1):
else:
if (1) echo hello;
endif;
?

thank you

miro



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] delete element from an array

2001-09-19 Thread Miroslav Figlar

Hi,

what is the best way to delete element from an array?
Suppose i have an array called $numbers:
$numbers = array(a = 10, b = 20, c = 30, d = 40);
I want to delete the third element from that array.

Thank you

Miro Figlar



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]