473,480 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Transliterate characters

In perl I was able to do:

$var =~ y/ĘÓĄŚŁŻŹĆŃęóąśłżźćń/EOASLZXCNeoaslzxcn/;

How does this oneliner look like in php?

Leszek Dubiel

PS. Already searched for help...and found no answer....
Jul 17 '05 #1
2 1661
On Fri, 20 Aug 2004 11:05:22 -0700, Leszek Dubiel wrote:
In perl I was able to do:

$var =~ y/ĘÓĄŚŁŻŹĆŃęóąśłżźćń/EOASLZXCNeoaslzxcn/;

How does this oneliner look like in php?

Leszek Dubiel

PS. Already searched for help...and found no answer....

PHP >= 4.3.0
$var = html_entity_decode($var, ENT_NOQUOTES);
Example taken from:
<http://uk.php.net/manual/en/function.html-entity-decode.php>
Pre-4.3.0 solution on that page also.
HTH =)

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #2
"Leszek Dubiel" <le****@dubiel.pl> wrote in message
news:72**************************@posting.google.c om...
In perl I was able to do:

$var =~ y/ĘÓĄŚŁŻŹĆŃęóąśł
żźćń/EOASLZXCNeoaslzxcn/;
How does this oneliner look like in php?

Leszek Dubiel

PS. Already searched for help...and found no answer....


The strtr() function is the PHP equivalent. The syntax is more verbose but
clearer.

$trans_tbl = array(
'&#280' => 'E',
'Ó' => 'O',
'&#260' => 'A',
....
);
$s = strtr($s, $trans_tbl);
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
47792
by: Pikkel | last post by:
i'm looking for a way to replace special characters with characters without accents, cedilles, etc.
7
8941
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
9
8131
by: Safalra | last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4 if that makes a difference) that loads an HTML file, removes invalid characters (or replaces them in the case of common ones...
43
3671
by: Vladimir | last post by:
Method UnicodeEncoding.GetMaxByteCount(charCount) returns charCount * 2. Method UTF8Encoding.GetMaxByteCount(charCount) returns charCount * 4. But why that? Look: /* Each Unicode character...
4
3820
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII...
20
9329
by: SMG | last post by:
Hi All, I have created an application which is working fine and is in about to launch, now suddenly my mgmt says there are chances that Scrip ID( a particular id and not prim key) may have special...
11
11081
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
9
3911
by: Nathan Sokalski | last post by:
I have several TextBoxes with TextMode="MultiLine" in which I want to limit the number of characters that can be entered using a RegularExpressionValidator. I have come up with the following...
6
2143
by: Deep | last post by:
Suppose there is a character of one byte then max characters possible under this are 256. If characters are of two bytes then max chars should be 65536. Now if character can be of one byte or two...
3
10171
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
0
7043
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7081
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6921
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5336
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.