This method returns a new instance of the same type as the original and with the same
attributes.
If the slice is empty, null is returned. The null value will be correctly handled in
concatenations using concat().
Offset and length have the same meaning as in array_slice().