Not really a question but kind of a challenge.. I have this PHP function that I always use and now I need it in Javascript. function formatBytes($bytes, $precision = 0) { $units = array(‘b’, ‘KB’…
Tag: php
how to include js file in php?
I have a problem with an js file in php. if i include it like this: the file isn’t included and i get an error that the function isn’t defined. When i try it this way: the first tag in the document.write function closes <script type=”text/javascript”> what is the correct way to d…
How do I remove quotes from a string?
How to remove all types of quotes (different languages) from $string? Answer I assume you mean quotation marks? Otherwise, go for some regex, this will work for html quotes for example: C-style quotes: CSS-style quotes: bash-style quotes: Etc etc…
PHP passing $_GET in the Linux command prompt
Say we usually it access via How do we execute the same on a Linux command prompt? But what about passing the $_GET variables? Maybe something like php -e index.php –a 1 –b 2 –c 3? I doubt that’ll work. Answer Typically, for passing arguments to a command line script, you will use eith…
How to disguise your PHP script as a browser?
We’ve been using information from a site for a while now (something that the site allows if you mention the source and we do) and we’ve been copying the information by hand. As you could imagine this …
MySQL sorting single field in multi orders
hi i am trying to sort a field with multiple orders for example here is my table 1st rule is to sort by Status. in following order: Active, Inactive, Merged, Promo A, Promo B, Promo C, Promo D, Defunct Once they are sorted like this within each of these categories the 2nd rule in following Order: Traditional,…
PHP – Uploading multiple files
I’m working on a plugin for wordpress and I want to be able to upload multiple pictures from a form. Right now when I have a form for two pictures and submit it empty, my $_FILES array looks like this: Now the problem is that I want to use wordpress’ upload handler, wp_handle_upload. It expects th…
Message: Undefined index: REMOTE_HOST in $_SERVER
Why do I get this error when I try to retrieve host name of remote user ? Message: Undefined index: REMOTE_HOST When reading documentation I came to know that it needs to be enabled in httpd.conf. …
I need a free php bug tracker [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 1 year ago. Improve this quest…
How can I use Basic HTTP Authentication in PHP?
I’m trying to use Basic HTTP Authentication and followed the example on the PHP manual page. But it doesn’t work for me. The variable $_SERVER[‘PHP_AUTH_USER’] doesn’t seem to be set. When a user try to log in, the user is prompted whith a new login-dialog. The server is running …