Код: Выделить всё
error_reporting(E_ALL);
Код: Выделить всё
$sentence = "Hello World";
$sentence[0] //Uninitialized string offset: 0
Код: Выделить всё
public static function prepareSentence($sentence)
{
$sentence = trim($sentence);
if ($sentence[0] == '"') //Uninitialized string offset: 0
$sentence = substr($sentence, 1, strlen($sentence));
if ($sentence[strlen($sentence) - 1] == '"')
$sentence = substr($sentence, 0, -1);
if ($sentence[0] == '"' || $sentence[strlen($sentence) - 1] == '"')
return self::prepareSentence($sentence);
return $sentence;
}
Заранее спасибо.
Подробнее здесь: https://stackoverflow.com/questions/913 ... g-offset-0
Мобильная версия