PHP Get price from span

Im new in PHP. Can you tell me how can I get price from span named “wordCounterPrice”. I have something like this:

class getPrice {
    public $price;
    public function __construct($data){
        $this->price = addslashes($data['wordCounterPrice']);
    }
}
...
if(isset($_POST['count'])){
    echo '<script>location.href="#test"</script>';
    $price = new getPrice($_POST);
...
}

HTML:

<span id="wordCounterPrice" name="wordCounterPrice">0</span>
<button type="submit" name="count" id="count" class="btn btn-primary">Get it</button>

So much thanks