I have a dynamically generated PHP web page where I change randomly the page
<h1> by synonyms.
Will search engines index the page for all or just for one synonym? Is it good option in terms of SEO?
It's going to index whatever it sees when it crawls the page. So one day it may be one word and the next day another. So this really isn't going to do anything for you. If you want to improve your rankings for the synonyms you should find a way to work them into your copy. That way they are all there, all the time.
I agree. Do not dynamically change your content unless it is dynamic content.
There are two things to remember here. Google automatically understands synonyms, plural, masculine and feminine, and European spellings and will try and match these after exact keyword matches in the SERPs. As well, it is a common practice to support keywords with synonyms and plural versions used higher in the content where it can be used naturally. I suggest tightly focusing your keywords in links, titles, descriptions and top few header tags and use keyword alternatives within the content itself. Pages that are tightly tuned perform better and not pages that try and appeal to too many search criteria.
Remember that SEO is less mechanical these days. It is less using triggers and more conversational. Your opportunities to influence SERPs is more content craft than old style SEO. The phrase content is king really applies. Subtle query changes can make huge differences these days and tweaking keywords is like chasing ghosts. For example SEO abstract and abstract SEO yields different results not because of SEO but because of the frame of mind of the searcher. Both get my page in the SERPs, but the user behavior is completely different effecting click-through rates and other metrics.
My point is to pick a set of keywords and tune your on-page optimization. Use alternatives in the content to gently broaden your reach. Be conversational. If after sufficient time to allow changes in the index to apply, 2-3 months, and you are not satisfied, then tweak the page and let settle again. SEO is a slow walk and not a run. You have to be decisive and patient.
Hope this helps. Good Luck!
As John mentioned, even if you often change
<h1> of your page, search engines will index it. And your page will be SEO optimized for synonym your inserted in these two tags during the bots pass through.
However, often changing
<h1> (good SEO spots for a keyword) is not a good practice. Indeed, a page should be optimized for a keyword (or a keywords expression) and even if these keywords are synonyms, I don't think search engines like these recurrent changes. It may mean you try some SEO techniques or something like that.