josedasilva @ 11:25

Seg, 09/10/06

Existem várias formas de efectuar comparação de variáveis, analise o seguinte código e indique qual o output esperado.


  1. < ?php

  2. </li>
  3. $string1 = "01";

  4. $string2 = 01;


  5. if($string1 === $string2)

  6. echo "1. EQUAL\n";

  7. else

  8. echo "1. NOT EQUAL\n";


  9. if(strcmp($string1,$string2)==0)

  10. echo "2. EQUAL\n";

  11. else

  12. echo "2. NOT EQUAL\n";


  13. if($string1 == $string2)

  14. echo "3. EQUAL\n";

  15. else

  16. echo "3. NOT EQUAL\n";

  17. ?>



Justifique as opções tomadas. (Solução Disponível)

Solução:

1. NOT EQUAL
2. NOT EQUAL
3. EQUAL

Explicação :

1. NOT EQUAL - $string1 === $string2 , verifica se $strin1 é igual a $string2 (na condição verifica-se) e se são do mesmo tipo (não se verifica)
2. NOT EQUAL - strcmp($string1,$string2) , Comparação de string segura para binário, como tal retorna falso
3. EQUAL - $string1 == $string2 , verifica se $strin1 é igual a $string2, sem comparação binária nem de tipos, retorna true

Tags:

cenourinha @ 21:40

Sab, 14/10/06

 

3. EQUAL

paragrafo

xD

amanda @ 04:32

Qui, 02/08/07

 

non nude little girls (http://amanda-bynes2007.info/non-nude-little-girls.html) naked preteen girl (http://amanda-bynes2007.info/naked-preteen-girl.html) naked teen girls (http://amanda-bynes2007.info/naked-teen-girls.html) tasteful nude girls (http://amanda-bynes2007.info/tasteful-nude-girls.html) naked biker girls (http://amanda-bynes2007.info/naked-biker-girls.html) nude collage girls (http://amanda-bynes2007.info/nude-collage-girls.html) teen girls nude (http://amanda-bynes2007.info/teen-girls-nude.html) nude spanish girls (http://amanda-bynes2007.info/nude-spanish-girls.html) nude asian girl (http://amanda-bynes2007.info/nude-asian-girl.html) teen girls naked (http://amanda-bynes2007.info/teen-girls-naked.html) asian nude girls (http://amanda-bynes2007.info/asian-nude-girls.html) nude girl photo galleries (http://amanda-bynes2007.info/nude-girl-photo-galleries.html) naked beach girls (http://amanda-bynes2007.info/naked-beach-girls.html) petite nude girls (http://amanda-bynes2007.info/petite-nude-girls.html) amanda bynes nude (http://amanda-bynes2007.info/index.html) tall naked girls (http://amanda-bynes2007.info/tall-naked-girls.html)

models @ 16:10

Seg, 30/07/07

 

naked british celebs (http://ultimatemalecelebs.info/naked-british-celebs.html) young non nude models (http://ultimatemalecelebs.info/young-non-nude-models.html) celeb nude scene (http://ultimatemalecelebs.info/celeb-nude-scene.html) jades nude celebrity (http://ultimatemalecelebs.info/jades-nude-celebrity.html) free nude male celeb (http://ultimatemalecelebs.info/free-nude-male-celeb.html) nude brazilian models (http://ultimatemalecelebs.info/nude-brazilian-models.html) fake celeb nudes (http://ultimatemalecelebs.info/fake-celeb-nudes.html) nude celeb galleries (http://ultimatemalecelebs.info/nude-celeb-galleries.html) nude black celebs (http://ultimatemalecelebs.info/nude-black-celebs.html) celebrity nude picture (http://ultimatemalecelebs.info/celebrity-nude-picture.html) nude celeb videos (http://ultimatemalecelebs.info/nude-celeb-videos.html) nude celeb gallery (http://ultimatemalecelebs.info/nude-celeb-gallery.html) nude fitness model (http://ultimatemalecelebs.info/nude-fitness-model.html) jades nude celebs (http://ultimatemalecelebs.info/jades-nude-celebs.html) nude japanese models (http://ultimatemalecelebs.info/nude-japanese-models.html)

cameron @ 21:43

Qui, 02/08/07

 

scooby doo porno (http://cameron-diaz2007.info/scooby-doo-porno.html) pornographic stories (http://cameron-diaz2007.info/pornographic-stories.html) porn movies.com (http://cameron-diaz2007.info/porn-movies.com.html) brooke biggs porn movies (http://cameron-diaz2007.info/brooke-biggs-porn-movies.html) cameron diaz xxx (http://cameron-diaz2007.info/cameron-diaz-xxx.html) free full length pornos (http://cameron-diaz2007.info/free-full-length-pornos.html) hot porn movies (http://cameron-diaz2007.info/hot-porn-movies.html) porn movie download (http://cameron-diaz2007.info/porn-movie-download.html) toon porn movies (http://cameron-diaz2007.info/toon-porn-movies.html) celeb porno (http://cameron-diaz2007.info/celeb-porno.html) movie titan porn (http://cameron-diaz2007.info/movie-titan-porn.html) simpson porno (http://cameron-diaz2007.info/simpson-porno.html) young porn movies (http://cameron-diaz2007.info/young-porn-movies.html) teen porn movie (http://cameron-diaz2007.info/teen-porn-movie.html)

Blog pessoal de José Silva. Sou programador informático, nos últimos anos dedicado quase exclusivamente ao PHP.
Outubro 2006
Dom
Seg
Ter
Qua
Qui
Sex
Sab

1
2
3
4
5
6
7

8
9
10
11
12
13
14

15
16
17
19
21

22
24
25
27
28

29
30
31


Pesquisar
 
blogs SAPO