I have something like
$a = "बिक्रम"
I want to achieve something like in php
a[0] = बि
a[1] = क्र
a[3] = म
now i want to count the letter of hindi name in a varial and how many vowel in hindi name(string). how to break hindi string in array with php and count how many letter and vowel in string Index page
<html>
<head>
<script src="http://www.hinkhoj.com/common/js/keyboard.js"></script>
<link rel="stylesheet" type="text/css" href="http://www.hinkhoj.com/common/css/keyboard.css" />
</head>
<body align="center" style="margin-top:15%">
Name :
<script language="javascript">
CreateCustomHindiTextBox("nameid", "", 40, true);
function ff() {
var a = document.getElementById("nameid").value;
var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "demo_get.php?val=" + a, true);
xmlhttp.send();
}
</script>
<input type="submit" name="submit" onClick="ff()">
<div id="myDiv"></div>
</body>
</html>
ajax page
<?php
function mbStringToArray ($string) {
$strlen = mb_strlen($string);
while ($strlen) {
$array[] = mb_substr($string,0,1,"UTF-8");
$string = mb_substr($string,1,$strlen,"UTF-8");
$strlen = mb_strlen($string);
}
return $array;
}
echo $name = $_GET['val'];
print_r(mbStringToArray($name));
?>