https://www.growthbook.io/ logo
o

orange-train-515

10/27/2021, 8:28 AM
HI. I've setup an experiment with a certain configuration (traffic split, traffic allocation etc.) in the interface, and it gave me this snippet of code to insert
Copy code
<?php
$experiment = new Growthbook\Experiment(
  "special-offers-test",
  ["Control", "Variation 1"]
);
$result = $user->experiment($experiment);

echo $result->value; // "Control" or "Variation 1"
The code itself doesn't reflect the configuration I chose (traffic split, traffic allocation). Is there something I should add to this default PHP code? I use interface on growthbook.io with PHP client library installed on my end. Thanks!
f

future-teacher-7046

10/27/2021, 12:49 PM
Hmm, that definitely used to show traffic split and coverage. The docs for the php library are here: https://docs.growthbook.io/lib/php#experiments For traffic split, you use the
weights
setting and for allocation you use the
coverage
setting.
I'll look into the code snippet generator and figure out why it's not including that.
o

orange-train-515

10/27/2021, 12:53 PM
Thanks! Maybe it isn't showed under every scenario, I'll try to play around