LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

366 solutions found in php-dev

Page 13 of 19
0 votes
1 ans
3 views
How can I write to the console in PHP?

Is it possible write a string or log into the console? ## What I mean Just like in JSP, if we print something like `system.out.println("some")`,...

php-dev Solved
LA
asked 1 month ago by Labeeb Panampullan
0 votes
1 ans
3 views
Replace keys in an array based on another lookup/mapping array

I have an associative array in the form `key => value` where key is a numerical value, however it is not a sequential numerical value. The key is actually an...

php-dev Solved
TH
asked 1 month ago by Thomas Owens
0 votes
1 ans
3 views
Difference between array_map, array_walk and array_filter

What exactly is the difference between `array_map`, `array_walk` and `array_filter`. What I could see from documentation is that you could pass a callback funct...

php-dev Solved
WE
asked 1 month ago by Web Logic
0 votes
1 ans
3 views
Can PHP cURL retrieve response headers AND body in a single request?

Is there any way to get both headers and body for a cURL request using PHP? I found that this option: curl_setopt($ch, CURLOPT_HEADER, true); is going...

php-dev Solved
GR
asked 1 month ago by gremo
0 votes
1 ans
3 views
How can I get the last 7 characters of a PHP string?

How would I go about grabbing the last 7 characters of the string below? For example: $dynamicstring = "2490slkj409slk5409els"; $newstr...

php-dev Solved
DA
asked 1 month ago by Dave
0 votes
1 ans
3 views
Laravel Checking If a Record Exists

I am new to Laravel. How do I find if a record exists? <!-- language: lang-php --> $user = User::where('email', '=', Input...

php-dev Solved
BE
asked 1 month ago by Ben
0 votes
1 ans
3 views
Get the Last Inserted Id Using Laravel Eloquent

I'm currently using the below code to insert data in a table: <!-- language: php --> <?php public function saveDetailsCompany(...

php-dev Solved
SO
asked 1 month ago by SoldierCorp
0 votes
1 ans
3 views
Call a REST API in PHP

Our client had given me a REST API to which I need to make a PHP call. But as a matter of fact, the documentation given with the API is very limited, so I don&#...

php-dev Solved
MI
asked 1 month ago by Michiel
0 votes
1 ans
3 views
How to get body of a JSON POST in PHP?

I submit as POST to a PHP page the following data: ```json {a:1} ``` In my PHP code, what do I have to do to extract that value? ```php var_dump($_PO...

php-dev Solved
IT
asked 1 month ago by Itay Moav -Malimovka
0 votes
1 ans
3 views
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 { protec...

php-dev Solved
JA
asked 1 month ago by Jannie Theunissen
0 votes
1 ans
3 views
PHP shell_exec() vs exec()

I'm struggling to understand the difference between `shell_exec()` and `exec()`... I've always used `exec()` to execute server side commands, when wo...

php-dev Solved
BE
asked 1 month ago by Ben
0 votes
1 ans
3 views
Pass a PHP variable to a JavaScript variable

What is the easiest way to encode a PHP string for output to a JavaScript variable? I have a PHP string which includes quotes and newlines. I need the conte...

php-dev Solved
DA
asked 1 month ago by David Laing
0 votes
1 ans
3 views
Extract a single (unsigned) integer from a string

I want to extract the digits from a string that contains numbers and letters like: "In My Cart : 11 items" I want to extract the number `11`...

php-dev Solved
DA
asked 1 month ago by Dali
0 votes
1 ans
3 views
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

I have recently installed Laravel 5 via Composer. I tried creating a new controller using Artisan and got the following error. Am I missing something? >bo...

php-dev Solved
SC
asked 1 month ago by Scott
0 votes
1 ans
3 views
How do you debug PHP scripts?

How do you debug **PHP** scripts? I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in **PHPEclipse** is also quite u...

php-dev Solved
MA
asked 1 month ago by Marcel
0 votes
1 ans
3 views
?: operator (the 'Elvis operator') in PHP

I saw this today in some PHP code: $items = $items ?: $this->_handle->result('next', $this->_result, $this); I'm not familiar wit...

php-dev Solved
AL
asked 1 month ago by alpha_juno
0 votes
1 ans
3 views
php create object without class

In JavaScript, you can easiliy create an object without a class by: myObj = {}; myObj.abc = "aaaa"; For PHP I've found this one,...

php-dev Solved
WO
asked 1 month ago by Wolfgang Adamec
0 votes
1 ans
3 views
How can I remove three characters at the end of a string in PHP?

How can I remove three characters at the end of a string in PHP? "abcabcabc" would become "abcabc"!

php-dev Solved
US
asked 1 month ago by user502039
0 votes
1 ans
3 views
PHP append one array to another (not array_push or +)

How to append one array to another without comparing their keys? $a = array( 'a', 'b' ); $b = array( 'c', 'd' ); At...

php-dev Solved
DA
asked 1 month ago by Danil K
0 votes
1 ans
3 views
How to convert date to timestamp in PHP?

How do I get timestamp from e.g. `22-09-2008`?

php-dev Solved
WI
asked 1 month ago by Wizard4U