Solved

Easy Conversion From ASP to PHP

Posted on 2008-06-19
6
228 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now