Find an Online Tutor Now

64 Answered Questions for the topic PHP

Can you help me find a topic

I need to make a program in php language, but I could not find what to write a topic or any php code written, can it help you in advance.

03/10/20

Which exact tecnology to use for a web with mobile apps realtime project?

We were planning to develop a realtime project in which features like call, chat, and video calls are there between customers and vendors and charged per minute from customers as per call/chat rate... more

08/26/19

Which Game Servers Hosting Control Panel is the best?

07/29/19

Which back-end web programming language to use?

I have a project where I will be collaborating to build a fairly simple site with some database access. I will be doing the back-end work, and my colleague will be doing the web design. The problem... more

07/29/19

How can I team up two MVC frameworks without having them fight each other?

I'm creating a CRUD-based web project, and am thinking about using a server side MVC framework (such as CodeIgniter or Laravel) in tandem with a client side MVC framework (such as AngularJS). Is... more

07/29/19

PHP: when to use arrays, and when to use objects for mostly-data-storing code constructs?

PHP is a mixed paradigm language, allowing to use and return non-object data types, such as arrays. I pose a question to try to clarify some guidelines for selection of arrays vs objects when... more
Php Ruby Perl

07/29/19

Is dynamic language always interpreted?

Looking at most (if not all) dynamic languages [i.e Python, PHP, Perl and Ruby], they are all interpreted. Correct me if I'm wrong. Is there any example of dynamic language that goes through... more
Php Mysql Json

07/22/19

php api json customization

I want build my own api using php like this https://opentdb.com/api.php?amount=5&category=9and Please check :1. amount=$amount2. catagory=$catagory
Php Logic

06/19/19

What should be passed into if() to print 'Hello World'?

What should be passed into the if() to print the output as "Hello World"? [Note: It should execute the else block.] if(?){ } else { echo "World"; }

06/19/19

unusual ternary operation?

I was asked to perform this operation of ternary operator use: $test='one'; echo $test == 'one' ? 'one' : $test == 'two' ? 'two' : 'three'; Which prints two (checked using php). I am still... more

06/19/19

Type-juggling and (strict) greater/lesser-than comparisons in PHP?

PHP is famous for its type-juggling. I must admit it puzzles me, and I'm having a hard time to find out basic logical/fundamental things in comparisons. For example: If `$a > $b` is true and... more

06/05/19

Where is my php.ini file located on the server?

A few years ago I installed Apache 2.2x and PHP 5.3.1 on a Linux server I maintain. I used .tar.gz's and built them as instructed (instead of rpms and what-have-you). And all was fine. Today I... more
Php

06/05/19

What is the difference between public, private, and protected in PHP?

When and why should I use `public`, `private`, and `protected` functions and variables inside a class? What is the difference between them? Examples: // Public public $variable; public... more
Php

06/05/19

Show a number to 2 decimal places?

What's the correct way to round a PHP string to 2 decimal places? $number = "520"; // It's a string from a DB $formatted_number = round_to_2dp($number); echo $formatted_number; The... more
Php

06/05/19

PHPDoc type hinting for array of objects?

So, in PHPDoc one can specify `@var` above the member variable declaration to hint at its type. Then an IDE, for ex. PHPEd, will know what type of object it's working with and will be able to... more
Php

06/05/19

How can I parse a JSON file with PHP?

I tried to parse a JSON file using PHP. But I am stuck now. This is the content of my JSON file: { "John": { "status":"Wait" }, "Jennifer": { "status":"Active" }, ... more
Php

06/04/19

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 differently when we are in first or last iteration. How... more
Php

06/03/19

Is there a function to make a copy of a PHP array to another?

Is there a function to make a copy of a PHP array to another? I have been burned a few times trying to copy PHP arrays. I want to copy an array defined inside an object to a global outside it.
Php

06/02/19

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 PHP?
Php

06/01/19

How to get useful error messages in PHP?

I find programming in PHP quite frustrating. Quite often I will try and run the script and just get a blank screen back. No error message, just empty screen. The cause might have been a simple... more
Php

05/30/19

How to find the foreach index?

Is it possible to find the `foreach` index? in a `for` loop as follows: for ($i = 0; $i < 10; ++$i) { echo $i . ' '; } `$i` will give you the index. Do I have to use the `for` loop... more
Php

05/29/19

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?

05/29/19

How to parse a string of boolean logic in PHP?

I'm building a PHP class with a private member function that returns a string value such as: 'true && true || false' to a public member function. (This string is the result of some regex... more
Php

05/28/19

What is thread safe or non-thread safe in PHP?

I saw different binaries for PHP, like non-thread or thread safe? What does this mean? What is the difference between these packages?
Php

05/28/19

Pass a PHP string to a JavaScript variable (and escape newlines)?

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 contents of this string to be put into a... more
1 3

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.