$y[1]
isn’t set.
You need to check there’s a value before running it through explode.
$y = explode( $b, $a );
if ( isset( $y[1] ) ) {
$x = explode( $c, $y[1] );
return ( isset( $x[0] ) ) ? $x[0] : '';
} else {
return '';
}
solved Notice: Undefined offset: 1 in