If you create a new instance of the class before you execute your function then the variable will get reset. So when you do the following:
$insert = new ShortURL();
$insert->insert();
echo $insert->id;
//You should see your value correctly
$insert = new ShortURL();
echo $insert->id;
//Now that you initialized the function again, the value is cleared
Try creating your class then reusing the same instance of the class.