LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

2108 solutions found in server-meltdown

Page 15 of 106
0 votes
1 ans
3 views
String comparison using '==' or '===' vs. 'strcmp()'

It seems that PHP's `===` operator is case sensitive. So is there a reason to use `strcmp()`? Is it safe to do something like the following? if ($...

php-dev Solved
JI
asked 1 month ago by Jiew Meng
0 votes
1 ans
3 views
WRONGTYPE Operation against a key holding the wrong kind of value php

I am using Laravel with Redis .When I am trying to access a key by get method then get following error "WRONGTYPE Operation against a key holding the wrong...

php-dev Solved
TR
asked 1 month ago by Trushar Narodia
0 votes
1 ans
3 views
How do I compare two DateTime objects in PHP 5.2.8?

Having a look on the PHP documentation, the following two methods of the `DateTime` object would both seem to solve my problem: - <a href="http://au....

php-dev Solved
RE
asked 1 month ago by RedBlueThing
0 votes
1 ans
3 views
What's the use of ob_start()?

Is `ob_start()` used for `output buffering` so that the headers are buffered and not sent to the browser? Am I making sense here? If not then why should we use...

general-dev Solved
AD
asked 1 month ago by Aditya Shukla
0 votes
1 ans
3 views
Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php

This error message is being presented, any suggestions? > Allowed memory size of 33554432 bytes exhausted (tried to allocate > 43148176 bytes) in php

php-dev Solved
PA
asked 1 month ago by panidarapu
0 votes
1 ans
3 views
Best practices to test protected methods with PHPUnit

I found the discussion on [Do you test private method][1] informative. I have decided, that in some classes, I want to have protected methods, but test them....

php-dev Solved
GR
asked 1 month ago by GrGr
0 votes
1 ans
3 views
How to call a function from a string stored in a variable?

I need to be able to call a function, but the function name is stored in a variable, is this possible? e.g: ```php function foo () { //code here }...

php-dev Solved
LI
asked 1 month ago by Lizard
0 votes
2 ans
4 views
Split a comma-delimited string into an array?

I need to split my string input into an array at the commas. Is there a way to explode a comma-separated string into a flat, indexed array? Input:...

php-dev Solved
KE
asked 1 month ago by Kevin
0 votes
1 ans
3 views
How to fix Error: laravel.log could not be opened?

I'm pretty new at laravel, in fact and I'm trying to create my very first project. for some reason I keep getting this error (I haven't even started...

php-dev Solved
FR
asked 1 month ago by frankelot
0 votes
2 ans
4 views
How to set HTTP header to UTF-8 using PHP which is valid in W3C validator

I have several [PHP][1] pages echoing out various things into [HTML][2] pages with the following code. <meta http-equiv="Content-type" conte...

php-dev Solved
MA
asked 1 month ago by manycheese
0 votes
1 ans
3 views
How to remove a cookie in PHP?

When I want to remove a Cookie I try unset($_COOKIE['hello']); I see in my cookie browser from firefox that the cookie still exists. How can I...

php-dev Solved
SA
asked 1 month ago by sanders
0 votes
1 ans
3 views
How to Set Variables in a Laravel Blade Template

I'm reading the Laravel Blade [documentation][1] and I can't figure out how to assign variables inside a template for use later. I can't do `{{ $old...

php-dev Solved
DU
asked 1 month ago by duality_
0 votes
2 ans
3 views
PHP exec() vs system() vs passthru()

What are the differences? Is there a specific situation or reason for each function? If yes, can you give some examples of those situations? PHP.net says...

php-dev Solved
CO
asked 1 month ago by codingbear
0 votes
1 ans
3 views
How to get xdebug var_dump to show full object/array

I am using [xdebug][1] (php_xdebug-2.1.2-5.3-vc9.dll) on [WAMP][2]. When I use `var_dump` on a large object or variable it does not show the full variable....

php-dev Solved
DM
asked 1 month ago by dm03514
0 votes
1 ans
3 views
'AND' vs '&&' as operator

I have a codebase where developers decided to use `AND` and `OR` instead of `&&` and `||`. I know that there is a difference in operators' preced...

general-dev Solved
TS
asked 1 month ago by ts.
0 votes
1 ans
3 views
Passing base64 encoded strings in URL

Is it safe to pass raw base64 encoded strings via GET parameters?

php-dev Solved
AL
asked 1 month ago by Alix Axel
0 votes
1 ans
3 views
How to Convert Boolean to String

I have a Boolean variable which I want to convert to a string: $res = true; I need the converted value to be of the format: `"true" "fa...

php-dev Solved
TA
asked 1 month ago by tag
0 votes
1 ans
3 views
Matching a space in regex

How can I match a space character in a PHP regular expression? I mean like "gavin schulz", the space in between the two words. I am using a regular...

php-dev Solved
GA
asked 1 month ago by Gavin Schulz
0 votes
1 ans
3 views
Get Specific Columns Using “With()” Function in Laravel Eloquent

I have two tables, `User` and `Post`. One `User` can have many `posts` and one `post` belongs to only one `user`. In my `User` model I have a `hasMany` rela...

php-dev Solved
AW
asked 1 month ago by Awais Qarni
0 votes
1 ans
3 views
Print PHP Call Stack

I'm looking for a way to print the call stack in PHP. Bonus points if the function flushes the IO buffer.

php-dev Solved
JU
asked 1 month ago by Justin