Jump to content


Help Understanding PHP Expression


3 replies to this topic

#1 jakevfr

    Young Padawan

  • Members
  • Pip
  • 40 posts

Posted 02 February 2007 - 05:05 PM

I'm trying to work with a PHP script and I've come accross this
$$_v=($$_c[2]!=''?$$_c[2]:$_c[2])

could someone kind of step me through what's happening here. I would appreciate it.

#2 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 02 February 2007 - 05:15 PM

its another way of doing an IF statement. I don't get what the deal with the $$ is thou, but here we go:

$$_v = if( $$_c[2] != '' ) { $$_c[2]; } else { $_c[2]; }

Thats how it would be laid out normally with the IF statement.

$$_v = the outcome of the if statement.

If value at position 3 of the array $$_c does not equal nothing, then $$_v gets set to the value at position 2 in the array $_c.

Matt

#3 jakevfr

    Young Padawan

  • Members
  • Pip
  • 40 posts

Posted 02 February 2007 - 05:38 PM

Thank you. Now I can finish up my program.

#4 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 03 February 2007 - 03:44 PM

View PostMr. Matt, on Feb 2 2007, 04:15 PM, said:

I don't get what the deal with the $$ is thou


Variable variables.
http://us3.php.net/m...es.variable.php

Edited by Demonslay, 03 February 2007 - 03:44 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users