WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World
Convert character code in variable(s)

mb_convert_variables

(PHP 4 >= 4.0.6, PHP 5)

mb_convert_variablesConvert character code in variable(s)

Description

string mb_convert_variables ( string $to_encoding , mixed $from_encoding , mixed &$vars [, mixed &$... ] )

Converts character encoding of variables vars in encoding from_encoding to encoding to_encoding .

mb_convert_variables() join strings in Array or Object to detect encoding, since encoding detection tends to fail for short strings. Therefore, it is impossible to mix encoding in single array or object.

Parameters

to_encoding

The encoding that the string is being converted to.

from_encoding

from_encoding is specified as an array or comma separated string, it tries to detect encoding from from-coding . When from_encoding is omitted, detect_order is used.

vars

vars is the reference to the variable being converted. String, Array and Object are accepted. mb_convert_variables() assumes all parameters have the same encoding.

...

Additional vars .

Return Values

The character encoding before conversion for success, or FALSE for failure.

Examples

Example #1 mb_convert_variables() example

<?php
/* Convert variables $post1, $post2 to internal encoding */
$interenc mb_internal_encoding();
$inputenc mb_convert_variables($interenc"ASCII,UTF-8,SJIS-win"$post1$post2);
?>


Convert number to words
Categories : PHP, Math., Arrays
Function to convert Arabic numbers into Roman Numerals
Categories : Algorithms, PHP, Date Time
sec2hms : Convert number of seconds to HH:MM:SS format
Categories : PHP, Date Time



Show the steps for converting a number from a given base to base 10. Shows the steps involved in converting a number from a given base to base 10.
Categories : PHP, Math., Algorithms
Decimal to Fraction - A function that converts numbers with decimal remainders to numbers with fractional remainders.
Categories : PHP, Math.
File size with label - afunction that reads the filesize from a selected file and convert the number of bytes into KB, MB etc
Categories : PHP, Filesystem
Creating thumbnails from MySQL Blobs online
Categories : PHP, MySQL, Graphics, HTML and PHP, Databases
Convert an IP address to the country name and display them to your visitor.
Categories : PHP, PHP Classes
Class for processing image (resizing the image size to create thumb nails and small images from actual image without loosing the aspect ratio of the image)
Categories : PHP, PHP Classes, Graphics
Scramble Eggs - php class to scramble/encode
Categories : PHP, PHP Classes, Security, Encryption
Validating Credit Card Numbers Without Bank Involvement
Categories : Credit Cards, Ecommerce, Java Script
Counting the number of words in user-supplied text
Categories : PHP, Strings
Comparing variables where one of the variables is a type float in IF conditions.
Categories : PHP, Variables
Linked comboboxes with php-mysql & javascript
Categories : PHP, Java Script, Databases, MySQL