Solved

Easy Conversion From ASP to PHP

Posted on 2008-06-19
6
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

734 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