1

I am making a horizontal bar chart. I want to make the width of the bar equal to an array value (the array is an array_count_value array) The array looks like this (array name is: $countValue):

Array ( [23] => 1 [2] => 4 [19] => 20 [18] => 21 [17] => 86 [16] => 108 [15] => 104 [14] => 102 [13] => 98 [12] => 117 [11] => 101 [1] => 86 [9] => 83 [8] => 36 )

I want the bar width to be something like this:

.barWidth { width: <?php echo $countValue[23]."px"; ?>;
2
  • External css files are usually not parsed by the PHP interpreter, I guess that is your problem and not the code itself?! Commented Oct 20, 2017 at 10:36
  • I fixed in the inline style thanks for the help. Commented Oct 21, 2017 at 15:29

1 Answer 1

2

Your Solution: use like bellow. not in style file.

<div style="width: <?php echo $countValue[23]."px"; ?>" class="class">
    <!-- your code -->
</div>
Sign up to request clarification or add additional context in comments.

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.