Jump to content

Special characters in wireArray()


ngrmm
 Share

Recommended Posts

I want to have filters with month names in german. I fetch them from date-fields with strftime('%B', $timestamp);
But i'm not able to add them correctly to a wireArray()

What's the right way to do that?

  
  $ms = wireArray();
  
  $m1 = strftime('%B', 1579643232); // Januar
  $m2 = strftime('%B', 1583107200);	// März

  $ms->prepend($m1);
  $ms->prepend($m2);

  foreach($ms as $name) {
	  echo "$name ";
		// result: Januar M�rz
  }

 

Link to comment
Share on other sites

i bypassed it with a static helper-array and it works.
would be nice to know how to do this without a helper array

$mNames = array("zero", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
$ms = wireArray();
  
  $m1 = date('n', 1579643232); // 1
  $m2 = date('n', 1583107200); // 3

  $ms->prepend($m1);
  $ms->prepend($m2);

  foreach($ms as $name) {
	  echo "$mNames[name] ";
  }
  // result: Januar März

 

Edited by ngrmm
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...