How can i create in PHP a file with a given size (no matter the content)? I have to create a file bigger than 1GB. Arround 4-10GB maximum
Tag: php
Object of class stdClass could not be converted to string
I am having a problem with PHP at the moment, I am getting this error, Object of class stdClass could not be converted to string the error occurs when I run this portion of code in my site, …
Creating a variable from a large, complicated section of html
I have several large (200+ lines) of html that I need to place in a variable to use several times in a loop. It gets very messy to escape this and that and keep formatting clean. Is there anyway to set a variable like this IF statement? I know its possible with external files, but Id rather not add a
How to animate multiple effects at same time using jQuery?
I am using jQuery’s animate() function to animate a div. When I give multiple effects like height 140 and width 200, then the next effects start only after the previous effects finish. I want to execute simultaneously. Any help will be appreciated. Answer The animate method accepts multiple style declar…
Why would $_FILES be empty when uploading files to PHP?
I have WampServer 2 installed on my Windows 7 computer. I’m using Apache 2.2.11 and PHP 5.2.11. When I attempt to upload any file from a form, it seems to upload, but in PHP, the $_FILES array is empty. There is no file in the c:wamptmp folder. I have configured php.ini to allow file uploads and such. T…
changing the title of a custom WordPress integrated page
When I need to add a custom page to WordPress based site I always load the theme’s header first: Unfortunately then every custom page gets the same title (the blog’s name) due to this code in header.php: What would be the best way to change this page title? Is there a wordpress method to call befo…
Php Destructors
Please give me some real life examples when you had to use __destruct in your classes. Answer Ok, since my last answer apparently didn’t hit the mark, let me try this again. There are plenty of resources and examples on the internet for this topic. Doing a bit of searching and browsing other framework&#…
PHP: How do I detect if an input string is Arabic
Is there a way to detect the language of the data being entered via the input field? Answer hmm i may offer an improved version of DimaKrasun’s function: okay, enough joking! Pekkas suggestion to use the google translate api is a good one! but you are relying on an external service which is always more …
Is it possible to filter the integer with decimal points using filter_var in PHP?
I need to filter the value like this 100.50 using filter_var in PHP. Now I am using like this filter_var($_POST[‘amount’],FILTER_SANITIZE_NUMBER_INT) : ”; And it gives me the result is 10050 . How can I solve this problem. Thanks in advance. Answer An integer does not have decimal fractions,…
How to replace new lines by regular expressions
How can I set any quantity of new lines with a regular expression? I need to remove every new line (n), not <br/>, between two paragraphs. Answer To begin with, str_replace() (which you referenced in your original question) is used to find a literal string and replace it. preg_replace() is used to find …