rubing Posted May 26, 2008 Share Posted May 26, 2008 This is a silly question, but google has a hard time searching for atypical characters. Here is a line in a javascript program I am trying to understand: this.url = (smURL||'soundmanager2.swf'); What is the meaning of || ? I thought || meant OR, but that wouldn't make sense in this context. Quote Link to comment Share on other sites More sharing options...
trq Posted May 26, 2008 Share Posted May 26, 2008 I does mean or and yes it makes perfect sense. If smURL is true (contains a value) then this.url will be set to its value, otherwise this.url will be set to soundmanager2.swf. Quote Link to comment Share on other sites More sharing options...
rubing Posted May 27, 2008 Author Share Posted May 27, 2008 I've never seen it written that way without an 'if' or at least a ':' Can you write it that way in php? Quote Link to comment Share on other sites More sharing options...
trq Posted May 27, 2008 Share Posted May 27, 2008 Can you write it that way in php? No, the equivelent in php would be.... <?php $url = $smURL ? $smURL : 'soundmanager2.smf'; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.