Array key exists vs isset function php comparison

Posted: 22 ноября 2011


I trying to compare result of php function array_key_exists and isset for array.

Попробовал сравнить результат выполнения функций для разных ключей массива.

Собственно код:


$test = array(
"0" => 0,
"1" => "0",
"2" => null,
"3" => false
);
echo "<table><th>key</th><th>val</th><th>array_key_exists</th><th>isset</th>";
foreach($test as $key=>$val){
	echo "<tr>";
		echo "<td>".$key."</td><td>".var_export($val, true)."</td><td style="background-color:#9d9d9d">".array_key_exists($key,$test)."</td><td>".(int)isset($test[$key])."</td><td></td><td></td>";
	echo "<tr/>";
}
echo "</table>";

И результат

keyvalarray_key_existsisset
0011
1'0'11
2NULL10
3false11

If you find the post helpful you can share it


Ваше мнение:

Имя

Smithd391 : 2014-08-08 22:25:30

whoah this blog is wonderful i like reading your articles. ceegagebkfkcgbcf

Pharmd963 : 2014-08-09 12:42:26

Very nice site! cheap goods

Pharmc794 : 2014-08-09 12:42:41

Very nice site! [url=http://opeyixa2.com/qovqo/2.html]cheap goods[/url]

Pharmb403 : 2014-08-09 12:46:22

Very nice site! cheap goods http://opeyixa2.com/qovqo/4.html

Pharmf804 : 2014-08-09 12:49:45

Very nice site!

Pharmb661 : 2014-08-10 19:01:06

Very nice site! cheap goods

Pharme104 : 2014-08-10 19:02:52

Very nice site! [url=http://oixapey2.com/aqsrr/2.html]cheap goods[/url]

Pharme72 : 2014-08-10 19:04:06

Very nice site! cheap goods http://oixapey2.com/aqsrr/4.html

Pharmg70 : 2014-08-11 00:47:36

Very nice site! cheap goods

Pharma772 : 2014-08-11 00:50:26

Very nice site! cheap goods http://ypxoiea2.com/qyaotq/4.html

Pharma410 : 2014-08-11 00:52:07

Very nice site!

Pharme98 : 2014-08-12 07:11:40

Very nice site! cheap goods

Pharmb223 : 2014-08-12 07:12:17

Very nice site! [url=http://apxoiey2.com/aovqx/2.html]cheap goods[/url]

Pharma377 : 2014-08-12 07:13:10

Very nice site! cheap goods http://apxoiey2.com/aovqx/4.html

Pharme361 : 2014-08-12 07:13:39

Very nice site!

Pharma785 : 2014-08-13 14:00:20

Very nice site! cheap goods

Pharmc13 : 2014-08-13 14:01:15

Very nice site! [url=http://apeoixy2.com/tqsrv/2.html]cheap goods[/url]

Pharmd895 : 2014-08-13 14:03:35

Very nice site! cheap goods http://apeoixy2.com/tqsrv/4.html

Pharmd987 : 2014-08-13 14:04:24

Very nice site!

Pharmd687 : 2014-08-14 20:18:13

Very nice site! cheap goods http://aieypxo2.com/tovqs/4.html

Pharmf824 : 2014-08-15 01:54:43

Very nice site! cheap goods

Pharmd878 : 2014-08-15 02:00:13

Very nice site! [url=http://aieypxo2.com/tovqs/2.html]cheap goods[/url]

Pharmg385 : 2014-08-15 02:00:34

Very nice site! cheap goods http://aieypxo2.com/tovqs/4.html

Pharmd167 : 2014-08-15 02:04:24

Very nice site!

Pharmb328 : 2014-08-15 07:34:31

Very nice site! cheap goods

Pharmg986 : 2014-08-15 07:38:53

Very nice site! cheap goods http://aieypxo2.com/tovqs/4.html

Pharmd625 : 2014-08-15 07:42:29

Very nice site!

Pharmg36 : 2014-08-16 14:03:58

Very nice site! cheap goods

Pharmf754 : 2014-08-16 14:14:01

Very nice site! [url=http://yieapxo2.com/qoqsr/2.html]cheap goods[/url]

Pharmk711 : 2014-08-16 20:06:49

Very nice site! cheap goods

Pharmf244 : 2014-08-16 20:07:37

Very nice site! cheap goods http://oieapxy2.com/tyaott/4.html

Pharmc840 : 2014-08-18 03:14:44

Very nice site! cheap goods

Pharme578 : 2014-08-19 15:39:13

Very nice site! cheap goods

Pharmg503 : 2014-08-19 15:47:16

Very nice site! cheap goods http://oixypea2.com/qxqsxoq/4.html

Pharma19 : 2014-08-19 17:04:56

Very nice site! cheap goods

Pharmd465 : 2014-08-19 17:07:09

Very nice site! cheap goods http://oixypea2.com/qxqsxoq/4.html

Pharmd588 : 2014-08-19 17:13:00

Very nice site!

Pharmd139 : 2014-08-19 19:21:24

Very nice site! [url=http://oixypea2.com/qxqsxoq/2.html]cheap goods[/url]

Pharmg917 : 2014-08-19 19:22:03

Very nice site! cheap goods http://oixypea2.com/qxqsxoq/4.html

Pharmd785 : 2014-08-19 19:23:31

Very nice site!

Smithd429 : 2016-12-29 07:37:33

I do believe all of the ideas you've offered for your post. They are really convincing and will definitely work. Still, the posts are very quick for newbies. May just you please extend them a little from next time? Thank you for the post. kdbeckdadkbfdaae

Pharmd736 : 2016-12-30 00:23:54

Hello!online pharmacy cialis

Pharme703 : 2016-12-30 00:24:22

Hello! online pharmacy cialis http://www.cia9online.com/#4.html

Pharme894 : 2016-12-30 00:25:16

Hello!

Pharma643 : 2016-12-31 06:29:13

Hello!cialis online pharmacy

Pharme434 : 2016-12-31 06:32:36

Hello! [url=http://www.cia9online.com/#2.html]cialis online pharmacy[/url]

Pharme471 : 2016-12-31 06:33:01

Hello! cialis online pharmacy http://www.cia9online.com/#4.html

Pharmd536 : 2016-12-31 06:33:23

Hello!

Pharmc427 : 2017-01-01 12:38:50

Hello!online pharmacy cialis

Pharmf287 : 2017-01-01 12:39:13

Hello! online pharmacy cialis http://www.cia9online.com/#4.html

Pharmd625 : 2017-01-01 12:41:11

Hello!

Pharmf484 : 2017-01-02 19:00:22

Hello!online pharmacy cialis

Pharmc562 : 2017-01-02 19:01:31

Hello! [url=http://www.cia9online.com/#2.html]online pharmacy cialis[/url]

Pharmd347 : 2017-01-02 19:02:06

Hello! online pharmacy cialis http://www.cia9online.com/#4.html

Pharmg605 : 2017-01-02 19:02:43

Hello!

Pharmd518 : 2017-01-04 01:13:35

Hello!online pharmacy cialis

Pharmf880 : 2017-01-04 01:14:02

Hello! [url=http://www.cia9online.com/#2.html]online pharmacy cialis[/url]

Pharme477 : 2017-01-04 01:14:54

Hello! online pharmacy cialis http://www.cia9online.com/#4.html

Pharma481 : 2017-01-04 01:15:22

Hello!

Pharmk267 : 2017-01-05 07:20:46

Hello! [url=http://www.cia9online.com/#2.html]online pharmacy cialis[/url]

Pharmb299 : 2017-01-05 07:21:05

Hello! online pharmacy cialis http://www.cia9online.com/#4.html

Pharmc87 : 2017-01-05 07:22:22

Hello!

Pharmf607 : 2017-01-06 13:22:27

Hello!online pharmacy cialis

Pharmc763 : 2017-01-06 13:24:19

Hello! [url=http://www.cia9online.com/#2.html]online pharmacy cialis[/url]

Pharmf946 : 2017-01-06 13:26:58

Hello! online pharmacy cialis http://www.cia9online.com/#4.html

Pharmb45 : 2017-01-06 13:27:25

Hello!
   other with PHP
drcreazy © 2008-2012 all rights reserved