Jump to content

tserfer

New Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by tserfer

  1. Helllo guys Lets say we have 2 strings that we want to replace . For example 1) rand( 2) mt_rand( (I know that these 2 are functions but lets say that they are strings). If i do: $source = preg_replace( "/rand\(/","NEW"); it will Replace the mt_rand as well and it will become mt_NEW( How can i fix it so that it will replace the whole function and not a part of it? We are talking about functions in strings Hope you understand Thanks
  2. This works in most cases but actually i want all the defined functions including PHP standard functions. Is that possible?
  3. Hello i am making a script that dumpes the function names and all variables names from a file. I dont want the get_defined_functions() file etc since i will not include it. I just get the source using file_get_contents. So how can i find all function names and variables names from a PHP File? Thank you
  4. There are many different ways to do it. An easy one is to serialize the array into string and save it into database. To fetch the data again you will use the unserialize method. Example $array_to_string = serialize($your_array); you can add the $array_to_string into a column now (column must be in TEXT) to fetch the data from the column $string_to_array = unserialize($column_array);
  5. Hello, I hate these preg_matches but this seems easy one I have the following string $string = "name=john; email=test@test.com; phone=4234234;"; I want to preg_match this $string to take our the keys name, email, phone and their values john, test@test.com and 4234234; What is special about this is that the string may not contain the character ; or it may have spaces between key and value. For example all the possible combinations are the followings. $string = "name=john; email=test@test.com; phone=4234234;"; #primary $string = "name=john; email=test@test.com; phone=4234234"; #it doesnt have for example the ; at the last one $string = "name =john; email =test@test.com; phone =4234234;"; #it has a space before the char = $string = "name = john; email = test@test.com; phone = 4234234;"; #it has a space after and before the = $string = "name= john;email= test@test.com;phone=4234234;"; #it can be like that, no spaces everywhere I hope you understand me. Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.