Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Ampersand


  • Please log in to reply
39 replies to this topic

#13 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 20 September 2008 - 05:18 AM

I just think there are much simpler solutions.


such as. :)
  • 0

#14 ArtoStiloz

ArtoStiloz

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 104 posts

Posted 20 September 2008 - 07:43 AM

such as. :)


Removing it, Apostrophe.. Your choice.
  • 0
[SIGPIC][/SIGPIC]
Http://www.ArtoStiloz.Dk

#15 morefood2001

morefood2001

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1011 posts

Posted 20 September 2008 - 09:05 AM

does 'AND' even work in place of &&? If so, what language does it work in? I can't think of any examples :/
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#16 ArtoStiloz

ArtoStiloz

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 104 posts

Posted 20 September 2008 - 09:28 AM

PHP
if($string1 == "Hello" && $string2 == "Hellow") {
print "Hello-Hellow";
}

  • 0
[SIGPIC][/SIGPIC]
Http://www.ArtoStiloz.Dk

#17 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 20 September 2008 - 09:59 AM

does 'AND' even work in place of &&? If so, what language does it work in? I can't think of any examples :/


I believe that PHP works like this.


if (5 == 5 && 3 == 3) {
echo "match";
}



if (5 == 5 and 3 == 3) {
echo "match";
}


However using && is much more readable. :)
  • 1

#18 ArtoStiloz

ArtoStiloz

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 104 posts

Posted 20 September 2008 - 10:08 AM

Well Echo is outdated.
  • 0
[SIGPIC][/SIGPIC]
Http://www.ArtoStiloz.Dk

#19 morefood2001

morefood2001

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1011 posts

Posted 20 September 2008 - 10:14 AM

I believe that PHP works like this.


if (5 == 5 && 3 == 3) {
echo "match";
}



if (5 == 5 and 3 == 3) {
echo "match";
}


However using && is much more readable. :)


I never knew that that would work. Thanks for the example :D
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#20 John

John

    CC Mentor

  • Moderator
  • 4450 posts
  • Location:New York, NY

Posted 20 September 2008 - 10:27 AM

I never knew that that would work. Thanks for the example :D


You never seen something like:
[php]$db = mysql_select_db('foo') or die(mysql_error());[/code]
&& and AND or || and OR also works in SQL syntax as well.
  • 0

#21 chili5

chili5

    CC Mentor

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3038 posts
  • Programming Language:Java, C#, PHP, JavaScript, Ruby, Transact-SQL
  • Learning:C, Java, C++, C#, PHP, JavaScript, Ruby, Transact-SQL, Assembly, Scheme, Haskell, Others

Posted 20 September 2008 - 10:40 AM

Well Echo is outdated.


what?

Anyways yeah you can use "and" and "or" in your code, but it's a bit easier to read with && and ||. :)
  • 0

#22 morefood2001

morefood2001

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1011 posts

Posted 20 September 2008 - 10:49 AM

I've always used && / || in if statements and AND/OR in mysql statements. I didn't know they could be used in either place.
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#23 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 20 September 2008 - 01:31 PM

Well Echo is outdated.


what's this mumbo jumbo?
echo is as valid as ever been...
  • 0

#24 ArtoStiloz

ArtoStiloz

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 104 posts

Posted 21 September 2008 - 07:05 AM

what?

Anyways yeah you can use "and" and "or" in your code, but it's a bit easier to read with && and ||. :)


ECHO belong to the past, PRINT belong to the present.
It is much easier to write AND instead of & & and | |
  • 0
[SIGPIC][/SIGPIC]
Http://www.ArtoStiloz.Dk




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download