'Javascript Console echo as php [duplicate]

I'm sure you can help me with my issue :).
I wrote a script with which I can read the current position - is in the console.
I would like to output it as PHP with echo but don't know how.

The script is as follows

<script>
    const successCallback = (position) => {
        console.log(position);
    };
    
    
    const errorCallback = (error) => {
        console.error(error);
    };

    navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
    console.log(latitude);
</script>

Thank you very much in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source