Equivalent code in Python to PHP -


i need equivalent code python code in php. val string containing 2 words seperated "-" , code separate them 2 different strings

here python code:

def function(val) :     s= false     ar = ""     = ""     x in val :          if s == true :              x.append(so)         elif x <> "-" :              x.append(ar)         elif x == "-" :             s= true 

$result = explode('-', $val); 

$result contains array of strings, split @ hyphen, i.e. $result[0], etc

http://php.net/explode


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -