The price to earnings (PE) ratio is literally what it says. You divide the price that you pay for the share by the earnings attributed to each share. The headline earnings per share (HEPS) can be calculated by dividing the total earnings for the year, by the amount of shares in issue. Okay, so this is a bit technical, so let me explain it with an example.
Suppose a company made a profit of R100 million for the year. Now suppose there is also 100 million shares in issue. So the company is divided into a 100 million smaller parts. If you divided the earnings of R100 million by the 100 million shares, earnings of R1 can be attributed to each share. If you now paid R10 for the share, you would be buying the share at a PE ratio of 10 (price of R10, divided by the earnings of R1).