I tried to ask this yesterday but made it sound more complicated than it is and i think no-one understood me. Given a string of the form "[place]hotel ref 12345" how can I echo just the 'place' part and lose the '[',']', and 'lovely hotel' Cheers
I get sent an XML file containing information about travel resorts. One of the bits of information is like [place]hotel ref 12345 eg [New York]5th Avenue hotel but I need to print out the 'place' part of the field without the rest of the information. ie I only want New York without the [ or ] or '5th Avenue hotel' so at the moment I have $place='[New York]5th Avenue hotel' but I only want $place='New York'
$place='[New York]5th Avenue hotel'; $a = explode(']',$place); $b = explode('[',$a[0]); echo $b[1]; //<---- New York PHP: