Hi guys,
I want to get the value '&' (amphersand). The only one condition is that it should not use another '&' (amphersand) to create it. I know html_entity_decode() can be used to it, but it uses the string value & in it. Any ideas?
Getting '&' from any decoding function or any method?
Moderator: General Moderators
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
Re: Getting '&' from any decoding function or any method?
Is this for a school assignment?
Re: Getting '&' from any decoding function or any method?
Actually, no. It is not. I was trying to hack some CSS, I mean putting some high width and high div. And for that I need to replace the Amphersand value in the string. html_entity_code is useful, so I used to display the < and > sign, but it was done, then the issue was with & (Amphersand), Then I got your answer, After this only one problem left, that is replacing the value of the php 's starting code,( < is < so, in the if I put <, it will again replace & with & ) it cannot be done, I think,
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Getting '&' from any decoding function or any method?
Examples would help, but in general some simple regexes will do it. To replace an & but not & something like this:
Code: Select all
$new = preg_replace('/&(?!amp;)/i', $replacement, $old);mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.