2

I have to generate a string using a given word, let's say "wheel" for full-text boolean mode search. But the second appearance of that word is replace after "<" sign when I'm trying to set the priority:

$word = 'wheel';
$x = '+(>' . $word . ' <' . $word . '*)';
echo $x;

The desired result should look like this:

+(>wheel <wheel*)

But instead the result is looking like this:

+(>wheel

But when I'm using var_dump I get the right length which is 17

I'm using PHP 5.6.40 Any idea why?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Melody
  • 127
  • 10

1 Answers1

2

Not sure why it's happening but if you add a space after < and single comma it's working fine. like this

$word = 'wheel';
$x = '+(>' . $word . ' < ' . $word . '*)';
echo $x;

Note: The extra space between < Symbol and ' Symbol

BlackXero
  • 880
  • 4
  • 17
  • you didn't read the question @BlackXero, i need the < operator for full-text search, adding an extra space removes its purpose – Melody Oct 20 '19 at 09:04