Solved

Easy Conversion From ASP to PHP

Posted on 2008-06-19
6
233 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to use embargo Date/time in php 29 36
Making API calls from hashed passwords 26 52
MySql and Apache/PHP Error Reporting 2 26
AWS EC2 & RDS Instance 5 34
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 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