agod Posted September 13, 2008 Share Posted September 13, 2008 how can i convert {*} into %7B%2A%7D ?? but i only want the chars converted. so if the text parsed is "help{*}" it displays "help%7B%2A%7D" Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/ Share on other sites More sharing options...
DarkWater Posted September 13, 2008 Share Posted September 13, 2008 $string = str_replace('{*}', '%7B%2A&7D', $string); Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640478 Share on other sites More sharing options...
DjMikeS Posted September 13, 2008 Share Posted September 13, 2008 I think this will suit your needs a bit better... http://nl3.php.net/htmlspecialchars Usage: string htmlspecialchars ( string $string [, int $quote_style [, string $charset [, bool $double_encode ]]] ) Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640482 Share on other sites More sharing options...
agod Posted September 13, 2008 Author Share Posted September 13, 2008 what is the conversion type? is it converting special chars into hes? Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640485 Share on other sites More sharing options...
DjMikeS Posted September 13, 2008 Share Posted September 13, 2008 My bad, You need this: string htmlentities ( string $string [, int $quote_style [, string $charset [, bool $double_encode ]]] ) Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640489 Share on other sites More sharing options...
agod Posted September 13, 2008 Author Share Posted September 13, 2008 doesnt seem to be working. $str = "help{*} " echo htmlentities($str); this does nothing Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640498 Share on other sites More sharing options...
DarkWater Posted September 13, 2008 Share Posted September 13, 2008 Did you try mine? Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640499 Share on other sites More sharing options...
agod Posted September 13, 2008 Author Share Posted September 13, 2008 yours would work but only for those chars. I need it to convert all chars except text. u get me? Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640500 Share on other sites More sharing options...
agod Posted September 13, 2008 Author Share Posted September 13, 2008 any ideas? Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640573 Share on other sites More sharing options...
sasa Posted September 14, 2008 Share Posted September 14, 2008 try <?php $test = "help{*}=?"; echo urlencode($test); ?> Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-640900 Share on other sites More sharing options...
agod Posted September 14, 2008 Author Share Posted September 14, 2008 thanks. that was what i was looking for. Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-641153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.