I’ve added a web testing section to my jj5-test project, and its hosted on Member Net in the test directory.
Now when I want to write little things that test/demo PHP features that I’m learning about I have a place to put the code.
I’ve added a web testing section to my jj5-test project, and its hosted on Member Net in the test directory.
Now when I want to write little things that test/demo PHP features that I’m learning about I have a place to put the code.
I’ve written a few little functions to help me sanitise content before including it in automatically generated JavaScript. The idea is to prevent code injection.
You can see the tests for my function in the scriptify_test.php file on ProgClub Member Net (where jsphp.co is hosted). You can view the scriptify unit tests in pcrepo.
Unit testing is fun! :)
I found the documentation for regular expressions at php.net.
I read somewhere on the internet to use the pattern modifiers “msU” to match multiline content, but while I understand the ‘m’ and the ‘s’ I don’t understand the ‘U’ very well. I’m not sure what it means to be greedy or ungreedy exactly. But I’ve been using msU pattern modifiers in my regexps that parse the phpjs.org content for import into jsphp.co.
I found out about a PHP function uniqid. You can see an example of its output on my test page.
Other functions that I’ve learned recently are usort, create_function and strcasecmp.
I also learned that if you want to link to the PHP function documentation you can use a link in the form http://php.net/function_exists where ‘function_exists’ is the function name you’re interested in.
I found out about the HTMLPurifier today. A HTML sanitisation library for PHP. Handy!
I worked through the Getting Started with Doctrine guide this evening, putting my content in the Pcphpjs project. There were a few hurdles to jump over, but in the end I got the sample application working in PHP with SQLite.