0

I'm kinda confused in my case,

$counts="$s{$process[$count]}";

if i echo $counts with

echo "$counts";

it still showing the value, how can i echo $counts to show the variable name

$steamroller

(in this case the process is 'team', and count is 'roller')) instead of the value of the variable $system?

EDIT okay i found it by myself it should be

$counts='$s'.$process."[".$count."]";

thank you..

6
  • Just use single quotes instead of double quotes in echo statement plz check here: 3v4l.org/VZHG8 Commented May 17, 2016 at 4:53
  • $counts or $count? Commented May 17, 2016 at 4:53
  • Possible duplicate of stackoverflow.com/questions/255312/… Commented May 17, 2016 at 4:56
  • @Ali that's not what i mean, the $steamroller itself is a variable that has a value, so every time i echo $count it always showing the value of $steamroller instead of "$steamroller", the wrong thing i think is how i save the variable in $counts Commented May 17, 2016 at 4:59
  • @FrayneKonok im sorry sir, i rate up your answer yesterday, maybe my internet connection is down, after i check again this time, my rate up and green check is missing, looks like it wasnt make it, sorry :) Commented May 18, 2016 at 4:10

2 Answers 2

2

Just make this:

$s = 's';
$count = 1;
$process[$count] = 'teamroller';

echo $counts = "$$s{$process[$count]}"; // $steamroller
Sign up to request clarification or add additional context in comments.

Comments

2

if you echo variable name in "" , php parse that variable an echo its value, if you want echo variable name with '' like this:

echo '$counts';  

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.