Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Easy Conversion From ASP to PHP

Posted on 2008-06-19
6
Medium Priority
?
237 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 17

Accepted Solution

by:
nplib earned 2000 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

Industry Leaders: 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!

Question has a verified solution.

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

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…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

721 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