Solved

Easy Conversion From ASP to PHP

Posted on 2008-06-19
6
234 Views
Last Modified: 2008-06-20
Experts,

I need these two pieces of ASP converted from ASP to PHP; should be pretty simple, but I'm not very good with both languages.

Lyell
<%
Dim String1
String1 = ""
For i = 1 to var
String1 = String1 & "../"
Next
%>
 
<%=String1%>

Open in new window

0
Comment
Question by:lyellr
  • 3
  • 2
6 Comments
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 21824657
<?PHP
//<%
//Dim String1
//String1 = ""
$string1 = ''';

//For i = 1 to var
for (i=0; i<= $var; i++) {

    //String1 = String1 & "../"
    $string = $string . "../";

//Next
//%>
}

//<%=String1%>
echo $string1
?>
0
 
LVL 17

Expert Comment

by:nplib
ID: 21825016
actually it would be like this
?PHP
//<%
//Dim String1
//String1 = ""
$string1 = "";
 
//For i = 1 to var
for (i=1; i<= $var; i++) {
 
    //String1 = String1 & "../"
    $string .= "../";
 
//Next
//%>
}
 
//<%=String1%>
echo $string1;
?>

Open in new window

0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 21825108
Either is correct. I intentionally chose not to use .= to keep it closer to ASP and be less confusing.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 17

Accepted Solution

by:
nplib earned 500 total points
ID: 21825135
yeah, but
this
//For i = 1 to var
for (i=0; i<= $var; i++) {
vs
//For i = 1 to var
for ($i=1;$ i<= $var; $i++) {

and this
echo $string1;
you forgot the ; at the end

<?PHP
//<%
//Dim String1
//String1 = ""
$string1 = "";
 
//For i = 1 to var
for ($i=1; $i<= $var; $i++) {
 
    //String1 = String1 & "../"
    $string .= "../";
 
//Next
//%>
}
 
//<%=String1%>
echo $string1;
?>

Open in new window

0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 21825208
Thanks, copy paste error.
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 21828918
php code without any comments:
<?
$string1="";
for($i=1; $i<=$var; $i++)
{
$string1 = $string1."../";
} 
 
echo $string1;
?>

Open in new window

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why will this INSERT statement not insert the date? 2 21
Asp in server side with Mssql Server 7 4 27
Code Manager | Snippits 2 37
Filktering Alphabetically 8 32
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question