Jump to content


Photo

php equivalent to asp's CStr


  • Please log in to reply
2 replies to this topic

#1 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 20 October 2006 - 05:43 PM

The subject says it all. I have been searching for hours and can't find an equivalent for what I am trying to do.

Here is the asp

CASE "Other Purchases"
  NB = 0
  For i = 1 to iCount       
    Quantity = Request("Quantity" & CStr(i))
    If IsNumeric(Quantity) Then
      ARYshopping(cartItemQuantity,i) = abs(CLng(Quantity))

The CStr function converts this variable to a subtype string.

I am at a loss on this one.

Any suggestion would be great.

Thanks,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 20 October 2006 - 06:59 PM

You don't need it. Type converion is automatic
<?php
$x = 'Quantity';
$y = 1;

echo $x.$y;   // --> Quantity1
 // or
echo "$x$y";   // --> Quantity1
?>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 21 October 2006 - 01:26 AM

Thanks Barand. I really appreciate it.

Thanks,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users