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" Quote 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); Quote 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 ]]] ) Quote 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? Quote 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 ]]] ) Quote 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 Quote 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? Quote 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? Quote 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? Quote 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); ?> Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/124063-converting-charachters/#findComment-641153 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.