truijens
-
Posts
5 -
Joined
-
Last visited
Posts posted by truijens
-
-
Use a regex of the possible operators.
preg_split('#(>=?|<=?|!?=)#', $str);
That would cover >, >=, <, <=, =, !=Thank you! Exactly what I was looking for.
-
Hi all,
I would like to parse a string containing key operator and value combinations like this:
type=location&postdate>10-12-2013&published!=0
The first step is to explode it based on & of course. But I am looking for an effective way to parse the rest. I could use a if, ifelse, ifelse to search for the operator and then explode on that, like this:
if (strpos('<=', $var) > 0) { $arr = explode('<=', $var); $operator = '<='; $key = $arr[0]; $value = $arr[1]; } ifelse (strpos('>=', $var) > 0) { $arr = explode('>=', $var); $operator = '>='; $key = $arr[0]; $value = $arr[1]; } etc...
But that is very ugly. Do any of you have any suggestions? Maybe regex?
Thanks in advance,
-
Ok, I found a solution. I was using MAMP on OS X and apparently there is some bug when executing binary executables.
dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Check your apache error log to see if you are encountering the same problem. An explanation and the solution that worked for me is provided here:http://jonathonhill.net/2012-06-22/cannot-run-a-binary-executable-from-php-and-mamp/
Good luck!
-
Hi,
I am trying to run a script using the php exec command. It is called 'Drush'. You might be familiar with it. It's a way to perform certain tasks on a Drupal site using the command line (bypassing Apache).
Anyway, when executing my drush command in the terminal manually it works just fine. But when executing it using exec() it doesn't seem to be able to find Drush. I set all the permission of the directory and all its contents to 777 and it is still not working. I am also calling drush using the entire path and not just drush as specified in .bash-profile.
Example:
/Applications/drush/drush --root="/Applications/MAMP/htdocs" --uri="client2.drupal.local" usu "nodes"
Where usu is a custom command and nodes is an argument. Again.., this works just fine when run manually in the terminal. Just not when executed using exec().
I tried executing 'ls' and that does work...
Does anybody have any idea what could be the problem here?
Thanks!
Roderick
Effectively parsing a string containing key+operator+value combinations.
in PHP Coding Help
Posted · Edited by truijens
Nah, they won't be used as URL. A setting "string" somewhere, but yes, they are purposefully very similar to querystrings to make it a bit easier on our app builder. So everything is kind of the same/familiar to him.