- array_slice: documentation ( source)
- print_r: documentation ( source)
- explode: documentation ( source)
<?php
// $output = array_slice(array_merge(explode(' | ', $input), array(null)), 0, 2);
$input = 'Hello | world | there';
$output = array_slice(explode(" | ", "$input | "), 0, 2);
print_r($output);