Hi,
I am trying to split a big chunk of string separated by semicolons into pieces of smaller ones and assign each smaller piece to different variables. It's like: $bigstr=piece1;piece2'piece3 and I want it to be like:
$smallstr1=piece1;
$smallstr2=piece2; and so forth;
How could I do it?

Thanks

Zhen

    $smallstr = explode(";",$bigstr);

    This will create an array of the small strings accessible via $smallstr[0], $smallstr[1] etc..

      Expanding on the last message, you can do something like the following:

      Assuming you have:
      $bigstr = "piece1;piece2;piece3";

      then:
      list($smallstr1, smallstr2, smallstr3) = explode(";",$bigstr);

      would do what you asked.

        Write a Reply...