PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
//to Extract Updated time info string
function GetExchangeData(UrlResult)
{
Result=new String(UrlResult);
Str=Result.substr(Result.indexOf("Last Trade",0)+1);
//Get the Token after Last Trade string in between character ';' and "Bid"
//Ex: Last Trade3:30PM · 46.49000Bid
BeginIndex=Str.indexOf(";",0)+2;
EndIndex=Str.indexOf("Bid",0)-1;
Data=Str.substr(BeginIndex,EndIndex-BeginIndex);
Str="";
return Number(Data);
}
**variables start with a $ sign in php
<?php (this is the start php tag)
//your instructions here including declaration of variables
example:
function getName{
$result=new String(UrlResult);
if (isset($_POST[$name]))
{
return ($_POST[$name]);
}
else
return($default);
tabariz wrote:I have a function in java script that I have no idea how to convert it into PHP and what are the equivalent codes for it
It should perhaps be pointed out to you that PHP executes on the server before the browser receives its output, whereas Javascript executes on the client side after the page has been served. Therefore, there is no "conversion" for Javascript into PHP.
Do you mean that you want to include this code in a page that will be evaluated by PHP?