mysqli , SQL-, . , mysqli PDO.
trim() .
trim - ( )
: , . trim() :
- "" (ASCII 32 (0x20)), .
- "\ t" (ASCII 9 (0x09)), .
- "\n" (ASCII 10 (0x0A)), ().
- "\ r" (ASCII 13 (0x0D)), .
- "\ 0" (ASCII 0 (0x00)), NUL-.
- "\ x0B" (ASCII 11 (0x0B)), .
:
trim() not remove , middle of the string, .
:
trim() , , ( ) . ('abc', 'bad') removes both ' a b', " , " b " , . " ", trim('abc', 'b'), , .
: , , , .
- , ,
preg_replace(). - , , , , , , .
3. You can directly adopt the method by strong the trimmed value into a variable and then echo it.
preg_match -
: , .
: preg_match() 1, , 0, , FALSE, .
1934 Heron Ave Unit D Schaumburg IL 60193 ( ) $res ['propertyaddress'], .
: .
- - , DB HTML-.
- , HTML, DB , , .
- , HTML,
CTRL+U, , . , , .
Query:
preg_replace("/(\W)+/", "", $word_to_undergo);
: \W - , , .
, Unicode \W , L N .
:
:
Query:
$needed_text = preg_replace("/[^A-Za-z0-9 ]/", "", $word_to_undergo);
, , .
:
$final_value = preg_replace("/(\W)+/", "", $word_to_undergo);
$final_value = preg_replace("/(\W)+/", "", $res['propertyaddress']);
2:
$final_value = preg_replace("/[^A-Za-z0-9 ]/", "", $word_to_undergo);
$final_value = preg_replace("/[^A-Za-z0-9 ]/", "", $res['propertyaddress']);
, .
<?php
$display=trim($res['propertyaddress']);
echo $display;
?>