Tag Archives: corda

str_replace for a utf8 string

str = "asd€aaa";
$str = str_replace("€","",$str);
Not replacing the € sign for some reason.
Eu tenho 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 Continue lendo

Tagged , | Deixe um comentário

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 andwipe outthe url. O Continue lendo

Tagged , , , , | Deixe um comentário

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 (*) agora mesmo:

$regex='#<span class="(*)"><a href="/venues/(*)">(.+?)</a></span>#';

Instead of ignoring (* ), it echoes Continue lendo

Tagged , , , | Deixe um comentário

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. Se eu echo… somente Continue lendo

Tagged , , , | Deixe um comentário

Girar uma corda N vezes em 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 Continue lendo

Tagged , | 4 Comentários

Seqüência do processo com caracteres especiais em PHP

I got an string like:
M%C3%B2nica
So I need to get something likeMònica”.
Which is the better way in PHP?… Continue lendo

Tagged , , | Deixe um comentário

Como verificar se StringB começa com stringa em PHP?

How can you check whether StringB starts with StringA if the length of both is variable? Continue lendo

Tagged , , , | 5 Comentários

PHP – Como faço para gerar strings com caracteres de controle ou dados binários?

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 Continue lendo

Tagged , , | 1 Como

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);

Continue lendo

Tagged , , | Deixe um comentário

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 pageContinue lendo

Tagged , , , , | Deixe um comentário
24 páginas