I’m trying to output multiline text with GD+PHP but can’t get it working. my php knowledge is really basic. here’s the code, any idea on how to output 2 or 3 lines of text? $theText = (isset($_GET[‘…
Tag: php
Is it possible to remove a Password from a PDF file using PHP?
I would like to ask if it’s possible to use PHP in removing a password from a password-protected PDF file in which I already know the password? I’ve seen this page which provides many options but using bash script. 🙁 I was required to use PHP as much as possible. Any suggestions appreciated! Answe…
How to add a new method to a php object on the fly?
How do I add a new method to an object “on the fly”? $me= new stdClass; $me->doSomething=function () { echo ‘I’ve done something’; }; $me->doSomething(); //Fatal error: Call to …
How do I convert output of number_format back to numbers in PHP?
PHP can’t recognize 1,200.00(generated by number_format) but only 1200.00, What’s the general solution for this problem? Answer You could remove any character that is not a digit or a decimal point and parse that with floatval: And if the number has not . as decimal point:
PHP Store User Data without Sessions
Is there anyway to store users data such as userid, email, etc to be accessible from all pages of a website after they have logged in, but without using sessions or cookies? For example: after they login at login.php now, how do I access $currentUser from another page, such as index.php if I shouldn’t u…
Convert a series of parent-child relationships into a hierarchical tree?
I have a bunch of name-parentname pairs, that I’d like to turn into as few heirarchical tree structures as possible. So for example, these could be the pairings: Which needs to be transformed into (a) heirarchical tree(s): The end result that I want is a nested set of <ul> elements, with each <…
How add class=’active’ to html menu with php
I want to put my html navigation in a separate php file so when I need to edit it, I only have to edit it once. The problem starts when I want to add the class active to the active page. I’ve got three pages and one common file. common.php : index.php : All three pages are identical except their
Outputting all PHP errors to database not error_log
Is it possible to make all PHP errors be written to MySQL instead of to the standard error_log file. I guess this would be possible if i wrote my own error handler from scratch but i have a lot of legacy code in place and ideally i would just make 1 global change and that would be it. Can this
Pause-able download for Apache
I have an Apache server running which hosts a php web application. This server also provides provisions for downloading a file size of around 900MB from it. However, while testing the application I found out that it’s not possible to pause the downloads and resume them later on. Could someone help me? I…
Handling big user IDs returned by FQL in PHP
I’m using FQL to retrieve a list of users from Facebook. For consistency I get the result as JSON. This causes a problem – since the returned JSON encodes the user IDs as numbers, json_decode() …