05/19/19
How to read a large file line by line?
I want to read a file line by line, but without completely loading it in memory.
My file is too large to open in memory, and if try to do so I always get out of memory errors.
The file size is 1 GB.
more
05/14/19
Remove empty array elements?
Some elements in my array are empty strings based on what the user has submitted. I need to remove those elements. I have this:
foreach($linksArray as $link)
{
if($link == '')
{
...
more
05/14/19
PHP array delete by value (not key)?
I have a PHP array as follows:
$messages = [312, 401, 1599, 3, ...];
I want to delete the element containing the value `$del_val` (for example, `$del_val=401`), but I don't know its key. This...
more
05/12/19
Best way to do multiple constructors in PHP?
You can't put two __construct functions with unique argument signatures in a PHP class. I'd like to do this:
class Student
{
protected $id;
protected $name;
// etc.
public...
more
05/12/19
Convert seconds to Hour:Minute:Second?
I need to convert seconds to "Hour:Minute:Second".
For example: "685" converted to "00:11:25"
How can I achieve this?
05/06/19
How to convert an array to object in PHP?
How can i convert an array like this to object?
<pre>
[128] => Array
(
[status] => Figure A.
Facebook's horizontal scrollbars showing up on a 1024x768 screen resolution.
...
more
04/25/19
How can I capture the result of var_dump to a string?
I'd like to capture the output of [`var_dump`](http://us3.php.net/manual/en/function.var-dump.php) to a string.
The PHP docs say;
>As with anything that outputs its result directly to the...
more
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.