Tag Archives: cordes
str_replace for a utf8 string
str = "asd€aaa";
$str = str_replace("€","",$str);
Not replacing the € sign for some reason.
J'ai mb_internal_encoding("UTF-8");… set up at the top of the file (which is saved in UTF-8).
The string originates from a MySQL db, so I also Continuer la lecture
Comment pouvez-vous obtenir le texte remplacé avec preg_replace?
I am using the preg_replace function in PHP and am trying to replace urls that users submit with bit.ly shortened links:
$comment = preg_replace( '/(http|ftp)+(s)?:(//)((w|.)+)(/)?(S+)?/i', '', $strText );
…
This will show only the comment and “wipe out” the url. L' Continuer la lecture
Regexp ignore certain parts in string
I need to use regex for a string to find matching results.
I need to find the (.+?) but would like to ignore everything where it says (*) pour le moment:
$regex='#<span class="(*)"><a href="/venues/(*)">(.+?)</a></span>#';
…
Instead of ignoring (* ), it echoes Continuer la lecture
Why wont all of this string print?
I am just trying to generate a path with something like :
$PhotoName = the_title();
$DestinationFile = 'temp/watermarked/';
$DestinationFile .= $PhotoName;
$DestinationFile .= '.jpg';
the_title(); is a WordPress function that gets the title of the post. If I echo… juste Continuer la lecture
Rotation d'une chaîne de N fois en PHP
I’m looking for a way to rotate a string to the left N times. Here are some examples:
Let the string be abcdef
if I rotate it 1 time I want
bcdefa
if I rotate it 2… time I want Continuer la lecture
Process string with special characters in PHP
I got an string like:
M%C3%B2nica
So I need to get something like “Mònica”.
Which is the better way in PHP?… Continuer la lecture
Comment vérifier si stringB commence par Stringa en PHP?
How can you check whether StringB starts with StringA if the length of both is variable…? Continuer la lecture
PHP – Comment puis-je générer des chaînes avec des caractères de contrôle ou de données binaires?
For testing purposes I need strings such as:
"testx00string"
…
I would like to loop over the control characters (00-1F) and generate the strings automatically so I don’t have to clutter my code with 31 lines like this but don’t know Continuer la lecture
Php – Remove repeated words in a string
Input: ball ball code
Output should be: ball code
Input: awycodeawy
Output should be: awycode
I tried these, but didn’t work:
$q = preg_replace("/s(w+s)1/i", "$1", $q);
$q = preg_replace("/s(w+s)1/i", "$1", $q);
…
PHP variables not being displayed between ajax call (kindof?)
I have a system laid out such that when a user hits a button the system makes an ajax call to another PHP page which contains a form and that PHP page echo’s it back to the current php page… Continuer la lecture





