Jump to content

JS -> PHP


crashmaster

Recommended Posts

Can anybody "translate" this into PHP ??

function toEntity() {
  var aa = document.form.utf.value;
  var bb = '';
  for(i=0; i<aa.length; i++)
  {
    if(aa.charCodeAt(i)>127)
    {
      bb += '&#' + aa.charCodeAt(i) + ';';
    }
    else
    {
      bb += aa.charAt(i);
    }
  }
  document.form.entity.value = bb;
}

 

Thx

Link to comment
https://forums.phpfreaks.com/topic/105275-js-php/
Share on other sites


function toEntity() {
  var aa = document.form.utf.value;
  var bb = '';
  for(i=0; i<aa.length; i++)
  {
    if(aa.charCodeAt(i)>127)
    {
      bb += '&#' + aa.charCodeAt(i) + ';';
    }
    else
    {
      bb += aa.charAt(i);
    }
  }
  document.form.entity.value = bb;
}

 

<?php
function toEntity(){
$aa = $_POST['frmval'];
$bb = '';
do while ($i <= $aa){
$i++;
}
}

// Not really sure what ur tryingb to do. Javascript is OOP while Php is primarily not. You will have to assign var's for length and stuff.
?>

Link to comment
https://forums.phpfreaks.com/topic/105275-js-php/#findComment-539221
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.