Asked  7 Months ago    Answers:  5   Viewed   49 times

the output is like below restored in a output.txt file:

array (
  'IMType' => '1',
  'Email' => '',
  'SignupName' => 'test11',
  'Password' => '11111',
  'Encrypted' => '',
  'Confirm' => '11111',
  'OldPassword' => '',
  'Name' => 'test',
  'SignupProvinceText' => 'province',
  'SignupCity' => 'cityname',
  'Street' => 'street x.y',
  'SignupIndustry' => 'IT',
  'SignupCompany' => 'jobirn',
  'SignupJt' => 'engineer',
  'CellPhoneNum' => '',
  'linked_in' => '',

it's in fact output of var_export(my_variable,true),but how to read it into a variable again?



like this:

$dumpStr = var_export($var,true);
eval('$somevar = ' . $dumpStr.';');
Wednesday, March 31, 2021
answered 7 Months ago

The manual specifies the backslash as unnecessary, which naturally means that if you still use it that the meaning is equivalent. However, as you have pointed out, the manual says that it is supposedly not allowed, which is false.

However, there is something else troubling with the manual. They advertise this:

// importing a global class
use ArrayObject;

If it is true that import names are not processed relative to the current namespace, then use ArrayObject and use ArrayObject must have the same meaning. What else could use ArrayObject refer to other than the global one? In practice, the engine will import the global one.

Also, with bugs such as this:

I believe there is confusion over what the standard is supposed to be.

To answer your question: there is no difference. However, if I was the engine developer who was also a believer of the no-leading-slash standard, then I wouldn't need to consider a case where someone wrote use Exception;. I believe this was likely the case.

Wednesday, March 31, 2021
answered 7 Months ago

You could use output buffering :


function test ($var) {
    echo $var;

$content = ob_get_clean();

var_dump($content); // string(5) "hello"

But it's not a clean and fun syntax to use. It may be a good idea to find a better library...

Wednesday, March 31, 2021
answered 7 Months ago

PHPExcel uses file_exists() to test the file before opening it. file_exists() requires stat() support, which is available for a limited subset of stream wrappers such as file:// ftp:// and ssh2.sftp but is not available for http://

You'll need to pull the file to the server's local filesystem first.

Tuesday, August 31, 2021
answered 2 Months ago

Process the lines inside the loop instead of after it. If you really need the file in a variable:

Saturday, September 4, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :