Tag Archives: stringa
str_replace for a utf8 string
str = "asd€aaa";
$str = str_replace("€","",$str);
Not replacing the € sign for some reason.
Ho 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 Continua a leggere
How can you get the replaced text with 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. Il Continua a leggere
Regexp ignorare alcune parti nella stringa
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 (*) proprio ora:
$regex='#<span class="(*)"><a href="/venues/(*)">(.+?)</a></span>#';
…
Instead of ignoring (* ), fa eco Continua a leggere
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… solo Continua a leggere
Rotazione di una stringa di N volte in 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 Continua a leggere
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?… Continua a leggere
Come verificare se StringB inizia con Stringa in PHP?
How can you check whether StringB starts with StringA if the length of both is variable…? Continua a leggere
PHP – Come faccio a generare stringhe con caratteri di controllo o di dati binari?
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 Continua a leggere
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… Continua a leggere





