php error reporting Uninitialized string offset: 0
For empty string, you can't use $sentence[0]
, that will cause the notice you got.
You can add !empty($sentence)
to check if it is empty.
For empty string, you can't use $sentence[0]
, that will cause the notice you got.
You can add !empty($sentence)
to check if it is empty.