Whenever an excavation is made to a depth of more than three feet below the established curb, the person who causes such excavation to be made, if afforded the necessary license to enter the adjoining premises, shall preserve and protect from injury at all times and at his own expense such adjoining structure or premises which may be affected by the excavation. If the necessary license is not afforded, it shall then be the duty of the owner of the adjoining premises to make his building or structure safe by installing proper underpinning or foundations or otherwise; and such owner, if it be necessary for the prosecution of his work, shall be granted the necessary license to enter the premises where the excavation or demolition is contemplated.
Whenever an excavation is made to a depth less than three feet below the curb, the owner of a neighboring building or structure, the safety of which may be affected by the proposed excavation, shall preserve and protect from injury and shall support his building or structure by the necessary underpinning or foundations. If necessary for that purpose, he shall be afforded a license to enter the premises where the excavation is contemplated.