1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 06:02:23 +02:00
Files
archived-php-src/tests/strings/offsets_general.phpt
George Peter Banyard c803499e23 Remove depreacted curly brace offset syntax
Closes GH-5221
2020-05-22 16:52:17 +02:00

26 lines
449 B
PHP

--TEST--
testing the behavior of string offsets
--FILE--
<?php
$string = "foobar";
const FOO = "BAR"[0];
var_dump(FOO);
var_dump($string[0]);
var_dump($string[1]);
var_dump(isset($string[0]));
var_dump(isset($string[0][0]));
var_dump($string["foo"]);
var_dump(isset($string["foo"]["bar"]));
?>
--EXPECTF--
string(1) "B"
string(1) "f"
string(1) "o"
bool(true)
bool(true)
Warning: Illegal string offset 'foo' in %s line %d
string(1) "f"
bool(false)