Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/07/2010, 09:31
VCLL
 
Fecha de Ingreso: junio-2010
Mensajes: 16
Antigüedad: 13 años, 10 meses
Puntos: 0
Elseif que no fncionan?

Tengo este código:
Código PHP:
Ver original
  1. if ($x == $x1 and $y == $y1){
  2. $tem = $vel;
  3. }elseif ($x == $x1 and $y != $y1){
  4. $x -= $x1;
  5. $tem = $x * $vel * 2;
  6. }elseif ($x != $x1 and $y == $y1){
  7. $y -= $y1;
  8. $tem = $y * $vel * 2;
  9. }elseif ($x != $x1 and $y != $y1){
  10. $x -= $x1;
  11. $y -= $y1;
  12. $x = pow($x,2);
  13. $y = pow($y,2);
  14. $suma = $x +$y;
  15. $log = sqrt ($suma);
  16. $tem = $log * $vel;
  17. }
Y resulta que cuando se ejecuta, se ejecuta bien para el primer if (cuando es el caso), y para el último elseif.
Pero cuando tiene que ejecutarse el primer elseif o el segundo, no se ejecutan ya que me aparece como resultado siempre 0.

No sé qué más hacer.

Un saludo