How can I show only text around my sql search term?
For example if I have this text and my search term is bubbles:
Humans can see bubbles because they have a different refractive index
(IR) than the surrounding substance. For example, the IR of air is
approximately 1.0003 and the IR of water is approximately 1.333.
Snell’s Law describes how electromagnetic waves change direction at
the interface between two mediums with different IR; thus bubbles can
be identified from the accompanying refraction and internal reflection
even though both the immersed and immersing mediums are transparent.The above explanation only holds for bubbles of one medium submerged
in another medium (e.g. bubbles of air in a soft drink); the volume of
a membrane bubble (e.g. soap bubble) will not distort light very much,
and one can only see a membrane bubble due to thin-film diffraction
and reflection.
How do I output something like this (with bold)….
Humans can see bubbles because they have a different refractive index
(IR) than … thus bubbles can be identified from the accompanying refraction and internal reflection even though both the immersed and immersing mediums are transparent.
Here is an example. You get the text from your sql query into
$text, but display after replacing keywords. See http://php.net/manual/en/function.preg-replace.phpOutput:
BTW – I have no idea why S/O shows Humans in different color 😉