How To pair and rearrange string values from a variable in PHP ?



  • Capture.PNG
    Let me summarize the above code, the first variable which is Parttype stores a list of part types from an input field, the second variable stores part labels and the third variable stores BIN numbers. As you can see my output from the commented code*(Line 187)*, I to take the first values and pair them together, take the second values and pair them together, and last values to pair them together too. How would I achieve this in PHP, just to summarize my question let me attach an image of what I want.
    Untitled-1.jpg



  • Hey @Leo-Lesole

    To do string concatenation in PHP you can use a period (dot)
    Example:

    $DataToDB = "Parttype=".$partType."&LabelPart=".$labelPart."&PartBin=".$partbin;
    

    Not sure if that is what you had in mind. Let me know.


Log in to reply