How can I take an array with individual strings but also comma separated strings and explode the comma separated items into individual items? For instance: $product_array[] returns: How can I split item 3 into individual items 3, 4 and 5 so that $product_array returns: Answer Here is fast solution 🙂 if there is comma it will explode it before adding
Tag: parsing
Force PHP to execute include even if there is an error later in the script
I am trying to create a system where by adding one include, I can set PHP to display errors (the php.ini file prevents this). In other words: This would create a parse error and “showerrors.php” does not get executed, meaning that the error never gets shown. However, if “showerrors.php” does get executed, the error would be shown. Answer If you
Get comments in a PHP file
I’ve been trying to get the comments out of a certain .php file on my server, in order to parse its variables. I thought Ii found an easy way to do this, however, the function I use doesn’t return anything, even though I clearly have comments in the file. Here are the comments I use: Here’s my code: Is there
Understanding ‘parse_str’ in PHP
I’m a PHP newbie trying to find a way to use parse_str to parse a number of URLs from a database (note: not from the request, they are already stored in a database, don’t ask… so _GET won’t work) So I’m trying this: Please note that here I am just supplying an example URL, in the real application the URL
How to use XMLReader in PHP?
I have the following XML file, the file is rather large and i haven’t been able to get simplexml to open and read the file so i’m trying XMLReader with no success in php I’ve unfortunately not found a good tutorial on this for PHP and would love to see how I can get each element content to store in