Note the values of both samples' $file_path. Note the '/' at the end on both.
Note the $url on both samples too. <i> </i><?php //NOTE: Use rawurlencode() for File Path Strings. Use before the '?'. //NOTE: Use urlencode() for Query Strings. Use after the '?'.
The quotes in this example serve no purpose. Otherwise I tend to prefer single quotes unless I need the capabilities of double quotes (variable interpolation or special escape characters like "n" or"t").
@NogDogMay 23.2021 — #Too much to read, but this is needless use of concatenation: [code=php]$file_path = $_SERVER['PHP_SELF'] .'/' .'search' .'/';[/code] Either of these will work: [code=php] $file_path = $_SERVER['PHP_SELF'] .'/search/'; $file_path = "{$_SERVER['PHP_SELF']}/search/"; [/code]
@NogDogJun 05.2021 — #> @developer_web#1632583 why the brackets on your 2nd example ?
Because that's how you can embed PHP variables within a double-quoted string (or a "HEREDOC"* string), regardless of whether it's an array element or object property, or if it would be unclear where the variable name ends. See [the manual](https://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex) for details.
_______________________
*[PHP manual entry on HERDOC](https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc)