Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($array as $index => $value) {
- echo $index;
- echo ' is ';
- echo gettype($index);
- echo "n";
- }
- $someList = Array('A' => 'Foo', 'B' => 'Bar', '' => 'Bah');
- print_r($someList);
- echo '<br/>';
- unset($someList['A']);
- print_r($someList);
- echo '<br/>';
- unset($someList['']);
- print_r($someList);
- echo '<br/>';
- Array ( [A] => Foo [B] => Bar [] => Bah )
- Array ( [B] => Bar [] => Bah )
- Array ( [B] => Bar )
- <?php
- $arr = array(
- false => 1
- , true => 2
- , null => 3
- , 'test' => 4
- // , '' => 5
- );
- print_r( $arr );
- foreach ( $arr as $key => $value )
- {
- var_dump( $key );
- }
- unset( $arr[''] );
- print_r( $arr );
- Array
- (
- [0] => 1
- [1] => 2
- [] => 3
- [test] => 4
- )
- int(0)
- int(1)
- string(0) ""
- string(4) "test"
- Array
- (
- [0] => 1
- [1] => 2
- [test] => 4
- )
- var_export($array);
- echo "n";
- unset($array[""]);
- var_export($array);
- array (
- '' => 1,
- )
- array (
- )
Add Comment
Please, Sign In to add comment