Detect if it is a new user or not in PHP I have been developing some plugin code for my registration form in Craft 3.

The event will be EVENT_AFTER_SAVE_ELEMENT, but I do not know how to detect if it is a new user or not.
In Craft 2, the way was if ($event-&gt;params['isNewUser']).

It would be grateful for me if someone tell me how to do it.
In Craft 3 you would do:

Event::on(
    Elements::class, 
    Elements::EVENT_AFTER_SAVE_ELEMENT,
    function(Event $event) {
        if ($event-&gt;element instanceof \craft\elements\User &amp;&amp; $event-&gt;isNew) {
            // It's a new user 
        }
    }
);