LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

366 solutions found in php-dev

Page 15 of 19
0 votes
1 ans
3 views
Converting an integer to a string in PHP

Is there a way to convert an integer to a string in PHP?

php-dev Solved
KM
asked 1 month ago by kman99
0 votes
1 ans
3 views
How to check whether an array is empty using PHP?

`players ` will either be empty or a comma separated list (or a single value). What is the easiest way to check if it's empty? I'm assuming I can do so...

php-dev Solved
AS
asked 1 month ago by aslum
0 votes
1 ans
3 views
What is the use of the @ symbol in PHP?

I have seen uses of `@` in front of certain functions, like the following: $fileHandle = @fopen($fileName, $writeAttributes); What is the use of this...

php-dev Solved
SV
asked 1 month ago by sv_in
0 votes
1 ans
3 views
PHP, cURL, and HTTP POST example?

Can anyone show me how to do a PHP cURL with an HTTP POST? I want to send data like this: username=user1, password=passuser1, gender=1 To `www.exam...

php-dev Solved
MY
asked 1 month ago by mysqllearner
0 votes
1 ans
3 views
Insert new item in array on any position in PHP

How can I insert a new item into an array on any position, for example in the middle of array?

php-dev Solved
KU
asked 1 month ago by kusanagi
0 votes
1 ans
3 views
PHP How to determine the first and last iteration in a foreach loop?

The question is simple. I have a `foreach` loop in my code: foreach($array as $element) { //code } In this loop, I want to react differe...

php-dev Solved
ME
asked 1 month ago by mehdi
0 votes
1 ans
3 views
How to create custom helper functions in Laravel

I would like to create helper functions to avoid repeating code between views in Laravel. For example: *view.blade.php* <p>Foo Formated text: {{...

php-dev Solved
CA
asked 1 month ago by Calebe Oliveira
0 votes
1 ans
3 views
Sort an array of associative arrays by column value

Given this array: $inventory = array( array("type"=>"fruit", "price"=>3.50), array("type&q...

php-dev Solved
MA
asked 1 month ago by Matt
0 votes
1 ans
3 views
How do I catch a PHP fatal (`E_ERROR`) error?

I can use `set_error_handler()` to catch most PHP errors, but it doesn't work for fatal (`E_ERROR`) errors, such as calling a function that doesn't exis...

php-dev Solved
TO
asked 1 month ago by too much php
0 votes
1 ans
3 views
PHP short-ternary ("Elvis") operator vs null coalescing operator

Can someone explain the differences between [ternary operator shorthand](https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comp...

php-dev Solved
BA
asked 1 month ago by balping
0 votes
1 ans
3 views
How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?

What is the difference between `==` and `===`? - How exactly does the loosely `==` comparison work? - How exactly does the strict `===` comparison work?...

php-dev Solved
NI
asked 1 month ago by nickf
0 votes
1 ans
3 views
How to get the last char of a string in PHP?

I need to get the last character of a string. Say I have "testers" as input string and I want the result to be "s". how can I do that in PH...

php-dev Solved
ST
asked 1 month ago by streetparade
0 votes
1 ans
3 views
NOW() function in PHP

Is there a PHP function that returns the date and time in the same format as the MySQL function `NOW()`? I know how to do it using `date()`, but I am asking...

php-dev Solved
MO
asked 1 month ago by MoeAmine
0 votes
1 ans
3 views
How do I make a redirect in PHP?

Is it possible to redirect a user to a different page through the use of PHP? Say the user goes to `www.example.com/page.php` and I want to redirect them to...

php-dev Solved
SA
asked 1 month ago by Sam
0 votes
1 ans
3 views
How to get the client IP address in PHP

How can I get the client IP address using PHP? I want to keep record of the user who logged into my website through his/her IP address.

php-dev Solved
AN
asked 1 month ago by Anup Prakash
0 votes
1 ans
3 views
Reference - What does this error mean in PHP?

### What is this? This is a number of answers about warnings, errors, and notices you might encounter while programming PHP and have no clue how to fix them....

php-dev Solved
HA
asked 1 month ago by hakre
0 votes
1 ans
3 views
How do I get the current date and time in PHP?

Which PHP function can return the current date/time?

php-dev Solved
MI
asked 1 month ago by Mike
0 votes
1 ans
3 views
Remove empty array elements

Some elements in my array are empty strings from users. `$linksArray` still has empty elements after the following: foreach($linksArray as $link) {...

php-dev Solved
WI
asked 1 month ago by Will
0 votes
1 ans
3 views
PHP random string generator

I'm trying to create a randomized string in PHP, and I get absolutely no output with this: <?php function RandomString() {...

php-dev Solved
CA
asked 1 month ago by Captain Lightning
0 votes
1 ans
3 views
Convert a PHP object to an associative array

I'm integrating an API to my website which works with data stored in objects while my code is written using arrays. I'd like a quick-and-dirty functi...

php-dev Solved
HA
asked 1 month ago by Haroldo