I want to add the category tree into select multiple options control
I search lot on this got this link
but it gives me output in ul li structure as follows

but I want this tree structure into select multiple options
can any one knows what to do changes in the link code
Preparing array:
Displaying in form: