How to display user nickname (not display name) in PHP template?

Because the $current_user object doesn’t have a property called user_nickName because the user nickname is stored in the user meta.

$user = wp_get_current_user();
$meta = get_user_meta( $user->ID );
$nickname = $meta->nickname;

Or

$nickname = get_user_meta( wp_get_current_user()->ID, 'nickname', true );

tech