I am trying to check if the lat,lon is in the polygon or not. Here is my array :
$vertices_x :
Array
(
[0] => -32.581189
[1] => -38.785885
[2
I don't think your point (173.5385,-34.472) is in the polygon.
Your x value is much larger than the largest x vertex. You can see this if you plot it. You can see from the orange point that even if you just have your lat/long mixed up it's still not in the polygon.
Upon first inspection of your new polygon and point it looks as though this one is more likely to be contained within the polygon (x_min < x < x_max and y_min < y < y_max).
-36.236432, 176.467563
-37.936530, 172.688266
-39.801068, 177.895786
-35.345287,-177.446011
-34.625208,-177.907437
point:
(-37.0278,176.6158)
However, plotting this again reveals that the point is outside the polygon:
... and zooming in ...
I plotted these in python with matplotlib and I recommend you do something similar when debugging this type of thing. If you want to stay with php, html, etc., you could use svg polygons or html canvas instead.