[ create a new paste ] login | about

Link: http://codepad.org/pwEC68w8    [ raw code | output | fork ]

PHP, pasted on Apr 21:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

function lol_php_coersion($hash) {
  $array = array();
  $array[$hash] = "Something or another";
  $key = key($array);
  
  echo "Starting with the string $hash\n";
  echo "Are they equal using ==: " . ($hash == $key ? "yes" : "no") . "\n";
  echo "Are they equal using ===: " . ($hash === $key ? "yes" : "no") . "\n\n";
}

lol_php_coersion("11111111");

lol_php_coersion("11111111111111");

lol_php_coersion("111111111111111111111111111111111111");


Output:
1
2
3
4
5
6
7
8
9
10
11
12
Starting with the string 11111111
Are they equal using ==: yes
Are they equal using ===: no

Starting with the string 11111111111111
Are they equal using ==: yes
Are they equal using ===: yes

Starting with the string 111111111111111111111111111111111111
Are they equal using ==: yes
Are they equal using ===: yes



Create a new paste based on this one


Comments: