Ben önadlı ve soyadı bir isim bölmek için php explode()
function çok basit bir kullanımı olduğunu düşündüğüm yazdık:
// split name into first and last
$split = explode(' ', $fullname, 2);
$first = $split[0];
$last = $split[1];
However, this is throwing up a php error with the message "Undefined offset: 1"
. The function still seems to work, but I'd like to clear up whatever is causing the error. I've checked the php manual but their examples use the same syntax as above.
I think I understand what an undefined offset is, but I can't see why my code is generating the error!