Skip to content

Tag: string

String and number in for each

I have this code: Expected result (to put as text in another PHP file): $Avroeger = 8.8; $Bvroeger = 5.5; Actual result: (where the 8.3 and 5.7 are the old values of $Avroeger and $Bvroeger) 8.3 = 8.8; 5.7 = 5.5; Anyone who can help? Thank you in advance! Answer You are doing the appending wrong. Do it as sho…

Seperate values from string in between characters in php

I have a string (“$big_string”) in php with is combination of small section of strings(“$string”) like this one “-val1(sec1)-“, for eg : How can I separate values from $big_string to an array-like the val1.. and so on values are between ‘-‘ & ‘(‘…

Transform text coma in an array

I am working with the PayPal API and I am trying to add multiple items to my itemList. My problem is that to make the itemList work, the array needs multiples variables: I am using a loop before, to set-up the items, which I am trying to gather into one variable: It doesn’t work and I think that the pro…

php substr() and currency symbol strange output

This is a little bit rude code and I am having this output for this simple string formatting sample. $originalValue is equal for example to “$50.00”; $currency is setted correctly to “$”; $value should be “50.00” but this is the result of the above dd() is: b”£50.00&#…